JacopoStanchi
JacopoStanchi

Reputation: 441

GET form redirecting to itself not working

I have a file named draft.html with a simple GET form redirecting to itself like that:

<!DOCTYPE html>
<html>
<body>
	<form action="draft.html" method="GET">
		<input type="text" id="test">
		<button type="submit">Valid</button>
	</form>
</body>
</html>

When I type something and click on Valid it redirects to draft.html but without the test parameter in the URL. What am I doing wrong?

Thank you for your help.

Upvotes: 0

Views: 72

Answers (1)

martonbognar
martonbognar

Reputation: 462

You need to add a name attribute to your inputs (the id is unnecessary here unless you have related JavaScript or CSS files that use it):

<input type="text" name="test" id="test">

Upvotes: 1

Related Questions