form action parameter not working
13,734
Solution 1
you have to use this code.
<a href="index.php?page=test"> Test </a>
<br><br>
<form action="index.php" method="get">
<input type="text" placeholder="enter text"> </input>
<input type="hidden" name="page" value="test">
<button type="submit">Send</button>
</form>
Solution 2
You are submitting a GET form. The data in the form will be expressed as a query string and replace the one in the URL in the action.
Move the data from the query string into hidden inputs inside the form.
Related videos on Youtube
Author by
Philipp
Updated on June 04, 2022Comments
-
Philipp almost 2 years
<a href="index.php?page=test"> Test </a> <br><br> <form action="index.php?page=test"> <input type="text" placeholder="enter text"> </input> <button type="submit">Send</button> </form>
Why is the link working correctly while the form gets me the url http://example.com/index.php? in the adress bar of the browser? Every parameter i define in the action attribute is getting cut off
-
Quentin about 9 years
-
miken32 almost 3 yearsDoes this answer your question? When submitting a GET form, the query string is removed from the action URL
-