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"); } Quote Link to comment Share on other sites More sharing options...
Dragen Posted June 26, 2007 Share Posted June 26, 2007 try using & instead of &. It may work Quote Link to comment Share on other sites More sharing options...
romio Posted June 26, 2007 Author Share Posted June 26, 2007 i tried it does not work Quote Link to comment 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); Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.