King Julien
King Julien

Reputation: 11308

How to hide button value in url?

This is my search form:

   <form action="" method="get" name="search">
   <input name="s" type="text" size="40" value="<?php echo $_GET["s"]; ?>" />
   <input name="submit" type="submit" value="Search" />
   </form>

When someone clicks the search button the url in browser's address bar is something like this:

http://example.com/?s=someting&submit=Search

How can I change it so that it only displays:

http://example.com/?s=someting

Hope I'm clear...

Upvotes: 5

Views: 3095

Answers (2)

Access2020
Access2020

Reputation: 84

Like " Ivar Bonsaksen " said you have to remove the "name" attribute because the value of every tag in the Form tag with a name attribute will be sent to the server and will appear in the URL.

P.S: You can use the POST method instead of GET to hide all the variables and values.

Upvotes: 0

Ivar Bonsaksen
Ivar Bonsaksen

Reputation: 4767

Remove name="submit" from the <input type="submit"> button

Upvotes: 9

Related Questions