0

I am using a button to function in the same way as a hyperlink:

<form action="intro.html"><input type="submit" value="CLICK HERE TO ENTER" ></form>

This works for static links, but does not work with PHP $_GET arguments.

<form action="wrong_choice.php?stage=0"><input type="submit" value="Wrong Choice!" ></form>

Clicking that will proceed to "wrong_choice.php" but not "wrong_choice.php?stage=0" How can I fix that?

Thank you

Adam Smith
  • 20
  • 3

3 Answers3

1

Action does not accept query string!

If you want to append data into the form which isn't part of the inputs filled by the user, add inside the <form>

<input type="hidden" name="stage" value="0" />
RaphaelDDL
  • 4,452
  • 2
  • 32
  • 56
1

Better to use:

<input type="button" value="Wrong Choice!" onClick="document.location.href('wrong_choice.php?stage=0');" />

If you do not want javascript, add method to form, delete parameter from action and add input with type hidden, which stands for parameter.

Tsar Ioann
  • 444
  • 4
  • 9
1

Action is what you want to do with the information in the form: you want to send the form in a email or send the information to another script to manage or comeback to same script. If you want pass arguments in the form you should put them in form's fields like that:

<form action="wrong_choice.php>
<input type='hidden' value='0' name="stage">
<input type="submit" value="Wrong Choice!" >
</form>

Thanks

Luferquisa
  • 73
  • 7