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
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
certain characters are used and reserved in URLs. You need to url encode the url before it's sent with urlencode()
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.
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
A small remark - the space is converted to plus, not %20.
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*).
ya it is +, but urlendcode is definitely the way to go
urlencode() is very simple solution. I liked it.
Thanks for other contributors though.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.