In MVC Framework.
I have a JavaScript that set the cookie value when I press a link button click. here is the code of my JavaScript:
<script type="text/javascript" >
(function() {
document.getElementById("mylink").onclick = function() {
var the_cookie = "video=video;" ;
document.cookie = the_cookie;
alert(document.cookie.value);
};
})();
</script>
And my link in local pc is :
http://localhost/nproject/index.php?c=files&a=index&active_project=1&1369323644[
^]
And I don't understand anything about this link as I am a new comer in MVC framework. I have just write this JavaScript in list_files.php. And my link button is on index.php. In index.php I have just add the link as like this:
echo '<div><a id = "mylink" value ="video"';
echo 'href="';
get_url('files');
echo '" >Video</a> </div>';
Because, the end of the index.php is :
<?php $this->includeTemplate(get_template_path('list_files', 'files')) ?>
As it is loading my list_files.php.
And when I am clicking on the link its alerting me "undefned". And I have also write my PHP code in list_files.php for getting cookies value in php variable for my another checking.
PHP variable set by Cookie:
<?php if(isset($_COOKIE["video"]))
{ $value = $_COOKIE["video"];
echo $value;
}
?>
As I am getting the result undefined so, I become confuse to do later jobs. Please help me.