Saturday, 10 August 2013

PHP - Click submit button but only submit textbox's value

PHP - Click submit button but only submit textbox's value

To preface everything: I'm very inexperienced with php, so don't assume
that I know anything.
I'm trying to get the input from the textbox here:
Image
With this as the code (Styling redacted):
<form action="something.php" method="get">
<div>
<input type="text" name="user" id="unfield">
</div>
<div>
<input type="button" name="example" id="example" value="Example">
<input type="submit" name="submit" id="submit">
</div>
</form>
I want it so that when the user hits enter or clicks the submit button, it
goes to something.php?user=textboxvalue, but instead, it goes to
something.php?user=textboxvalue&submit=Submit. How would I only pass the
user value?
Also, I want the 'example' button to redirect the user to a fixed page.
How would I do that?

No comments:

Post a Comment