Search code examples
phpformssubmission

How to remove special characters in URL during Form Submission


I am trying to remove the special characters during form submission in PHP. Everytime I want to submit a data for example :

<form action="?" method="get">
<input type="text" name="str" value="I want to remove this" />
</form>

the output in the browser looks like this

http://localhost/?str=I+want+to+remove+this 

Is there anyway that we can get rid of those "+" before submission or during submission?

My expected result is

http://localhost/?str=I want to remove this

Thanks for your help...


Solution

  • In the url you cannot have empty spaces, on the server side

    str=I+want+to+remove+this 
    

    will be read as

    str=I want to remove this
    

    only. So i do not think you really need to worry about that encoding.