Elice Ee
Elice Ee

Reputation: 129

PHP echo Cookies with plus sign or space

I have set my cookies name with a value with spacing. I have check the cookies value in the browser is John+Steve. However echo through the website, it shows John only and ignore value after +.

<?php
      setcookie('name','John Steve');
?>
<?php
      if(isset($_COOKIE['name'])){
         echo $_COOKIE['name']; 
      }
?> 

I have try echo the cookies with

echo rawurldecode($_COOKIE['name']);

It still show the same results. Please help me solve this problem and echo it with John Steve as well. Thanks!!!

Upvotes: 2

Views: 1135

Answers (1)

Arshid KV
Arshid KV

Reputation: 10037

Try as follows echo urldecode($_COOKIE['name']);

Upvotes: 1

Related Questions