user1759682 user1759682 - 1 year ago 67
HTML Question

Why is the submit button value passed when using the GET method in HTML?

I am using the the "GET" method in a form on my website. For some reason it is passing the value of the submit button to the url. Why is this happening? What am I doing wrong?


<form method="GET" action="searcht1.php">
<input type="text" name="search"/>
<input type="submit" name="submit">



Answer Source

It's supposed to happen. If you don't want that, do not define name attribute on the button. You probably want value instead, to show the user what the button is for.

Also, this question has nothing to do with PHP; it is purely about HTML semantics.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download