javascript - Can PHP set cookie function, Overwrite cookie value created with JQuery cookie -
i trying have 1 set cookie , value of cookie gets overwritten php when user logs in, creates separate cookie, here snippet of code setting cookie value
<?php include("db_connect.php"); $input_game = $_post['game']; $input_user = $_post['email']; $sql = "update users_table set pref_game = '" . $input_game . "' email='" . $input_user . "'"; if ($conn->query($sql) === true) { $cookie_name2 = "content"; $sql="select pref_game users_table email='$input_user'"; $result = $conn->query($sql); $row = $result->fetch_object(); setcookie($cookie_name2,$row->pref_game, time() + (86400 * 30), "/"); // 86400 = 1 day } else { //error } ?>
below jquery cookie code clarity:
$("#test-cookie").click(function() { $.cookie('content', 'test'); location.reload(); });
is there anyway php can update/overwrite cookie value created jquery?
php overwrite jquery's cookie if has exact same name, path, , domain. path has jquery cookie been written for? @ in browsers development console. if within directory when set, may need use expression $.cookie('name', 'value', { expires: 7, path: '/' }); set / php cookie has done.
this answered question thank you:
$("#test-cookie").click(function() { $.cookie('content', 'test', { expires: 7, path: '/' }); location.reload(); });
Comments
Post a Comment