php - why sometimes space is + and sometimes is %20 in the URL? -


i have 2 page each of them has 1 form. this:

// index.php  <form name="sampleform" method="get"  action="search.php"> <input id="q" name="q" type="text"/>  //  text field <input name="" type="submit" />       //  button </form>   // search.php  <form name="sampleform" method="get"  action=""> <input id="q" name="q" type="text"/>  //  text field <input name="" type="submit" />       //  button </form>  

now, when submit index.php url this:

www.example.com/search.php?q=foo+bar 

but when submit search.php url this:

www.example.com/search.php?q=foo%20bar 

why ? , how can fix ? (i want +)


edit: index.php search.php not ajax, search.php search.php ajax. that's true, reason of changing + %20 redirecting. so, possible convert %20 + in redirected page ?

well, default web form use + form.

the difference in index.php directly sending data result.php , hence browser gives +

but in search.php, result given first search.php (as action "") , guessing redirecting result.php. redirection converting + %20

finally, both equivalent - doesnt matter 1 use.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -