0

In a form (eg. Search box), like the one at the top right of this page, when I write a word into it and press enter, I can see the search results on the page, but the word I have searched for remains in the box too. Can someone tell me which attribute this is? I can't find one. I am aware that "placeholder" is for the word 'search' in the box before a search is carried out, but how do I ensure the searched word stays in the box after the word is searched for and does not disappear? Thank you!

rjm
  • 23
  • 2

1 Answers1

1

https://stackoverflow.com/search?q=sea

Where q is GET request parameter. Can be simply access by server side scripting.

Suppose for PHP It's: $_GET

echo $_GET['q'];//sea

You can't do this with simple HTML. If you aren't using any serverside scripting you can do this with javascript:

Read this How can I get query string values in JavaScript?

Community
  • 1
  • 1
Manwal
  • 23,450
  • 12
  • 63
  • 93
  • OK, thank you. So basically if I copy the code of a search box to use with different styling on the same page, I can't make sure the searched word stays in the box, because I can't see the PHP? Unless I use Javascript? – rjm Apr 22 '15 at 15:48
  • value="" inside your input – Blkc Jun 24 '15 at 00:53