user8782879
user8782879

Reputation:

Add a space between value in a cookie using PHP

Simple question but cant find the answer. I have this line of code:

setcookie($prodAmount, $pQuantity." ".$pOriginalQuan, time() + (86400 * 60), "/");

As you can see there is a space in the middle. however when I look at the cookie in the browser values are like this 3+4. how can I add space to the cookie so it looks like this 3 4.

Thanks

Upvotes: 1

Views: 368

Answers (1)

Daniel E.
Daniel E.

Reputation: 2480

A cookie value and name is a sequence of characters excluding semi-colon, comma and white space.

So you can't do that.

But you can use the function string urldecode ( string $str ) to get back you whitespace.

Upvotes: 3

Related Questions