0

Hi,

This is my URL index.php?name=BSC&Subject=C++ When I do echo $_GET["Subject"]; , result is C without ++

I also tried (string) and settype() functions but no luck


How do I solve this problem?

Thanks

4
Contributors
8
Replies
9
Views
7 Years
Discussion Span
Last Post by veledrom
1

Using urlencode() may solve the problem, but the thing is that plus and space signs in URL have the same value, they are not recomeded to use at all in URLs.

Edited by amd_k8: n/a

0

Using urlencode() may solve the problem, but the thing is that plus and space signs in URL have the same value, they are not recomeded to use at all in URLs.

urlencode will convert them so they are fine and feel free to use them. space becomes %20, etc

0

A small remark - the space is converted to plus, not %20.

Edited by amd_k8: n/a

0

Seems to work fine for me. I built this quick test:

<?php 
if(isset($_GET['q'])){
  echo "GET variable spits out: {$_GET['q']}";  
}
$q = urlencode('fdy+ +');
?>
<a href="?q=<?php echo $q;?>">hello</a>

True enough - space becomes '+' - but only after encoding.
Plus symbol is changed to '%2B'. Straightforward (*I think*).

1

urlencode() is very simple solution. I liked it.
Thanks for other contributors though.

Votes + Comments
kudos on the follow up :D
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.