Reputation:
I am using a little script, and in the generated content I get a %20 instead of a space.
This is the script I'm using:
index.php
what is your name?
<FORM METHOD="LINK" ACTION="temp.php?name=">
<input type="text" value="" name="name" ></input>
<input type="submit" value="Submit" ></input>
</form>
and on temp.php
<?php
$name = rawurlencode( $_GET['name'] );
echo "<h1>" . $name . "</h1>";
?>
Hello <?php print $name ?> how are you?
If I input Mr Example
, it renders as Mr%20Example. It does the same for the url temp.php?name=Mr%20Example
Upvotes: 2
Views: 473
Reputation: 30488
the %20 comes because you have used rawurlencode
$name = rawurlencode( $_GET['name'] );
You have to use rawurldecode , it will replace all this kind of character to original character.
$name = rawurldecode( $_GET['name'] );
Upvotes: 0
Reputation: 6877
use this instead
<?php
$name = urldecode($_GET['name'])
echo "<h1>" . $name . "</h1>";
?>
Upvotes: 2