Reputation: 3394
If you encode something using javascript's encodeURI()
method, how do yo get the decoded string in PHP?
I have string name= "salman mahmood"
which I'm sending via POST message to my server. When I alert()
the string at client side it gives me "salman%20mahmood" after encoding.
At server side I'm decoding it using urldecode()
but the result I'm getting is "salman". Do I need a different method to decode? the rawurldecode
isnt working either; I just need the value with the space restored back.
Edit: thanks every one for the suggestions but im writing the code as follows and it still doesnt work!!
<input type="text" id="chapterNumber" value=<?php echo rawurldecode("chapter%20Two"); ?> disabled="disabled">
it only prints "chapter"
Upvotes: 2
Views: 2315
Reputation: 50976
Put it into quotes ' '
<input type="text" id="chapterNumber" value='<?php echo rawurldecode("chapter%20Two"); ?>'disabled="disabled">
Upvotes: 2