Jump to content

Saving "&" in cookie... shows %26 instead!


romio

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.