romio Posted June 26, 2007 Share Posted June 26, 2007 I am trying to save in a cookies some products "id's" separated by "&", but for some reasons in my cookie it does display “%26” instead, why this happening? if(!isset($_COOKIE['mybasket'])){ $store_id = $store_id.'&'; setcookie("mybasket",$store_id); }else{ $all_store_id = explode("&", $_COOKIE['mybasket']); array_push($all_store_id, "$store_id&"); $all_store_id = implode($all_store_id); setcookie("mybasket","$all_store_id"); } Link to comment https://forums.phpfreaks.com/topic/57215-saving-in-cookie-shows-26-instead/ Share on other sites More sharing options...
Dragen Posted June 26, 2007 Share Posted June 26, 2007 try using & instead of &. It may work Link to comment https://forums.phpfreaks.com/topic/57215-saving-in-cookie-shows-26-instead/#findComment-282866 Share on other sites More sharing options...
romio Posted June 26, 2007 Author Share Posted June 26, 2007 i tried it does not work Link to comment https://forums.phpfreaks.com/topic/57215-saving-in-cookie-shows-26-instead/#findComment-282873 Share on other sites More sharing options...
Dragen Posted June 26, 2007 Share Posted June 26, 2007 What about changing the cookie when you call it? put it through str_replace.. str_replace("%26", "&", COOKIENAME); Link to comment https://forums.phpfreaks.com/topic/57215-saving-in-cookie-shows-26-instead/#findComment-282874 Share on other sites More sharing options...
Wildbug Posted June 26, 2007 Share Posted June 26, 2007 I am trying to save in a cookies some products "id's" separated by "&", but for some reasons in my cookie it does display “%26” instead, why this happening? http://asciitable.com/ %26 is the hex representation of "&" since "&" is a special character. Try urldecode() to change it back. Link to comment https://forums.phpfreaks.com/topic/57215-saving-in-cookie-shows-26-instead/#findComment-282989 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.