0
<form method="get" action="<?php echo $_SERVER['PHP_SELF']?>">

<h3>Select your product and click submit</h3><br />

<select name="prod">

<option value="default">Select your product</option>

<option value="os">Operating Systems</option>

<option value="mobile">Smart Mobiles</option>

<option value="mobile">Computers</option>

<option value="shirt">Shirts</option>

</select><br /><br />

<input type="submit" value="Submit" name="submit"/>

</form>

3 Answers 3

3

You could check if the value of the submit control exists.

if(isset($_GET['submit']))

This way, when the form will be posted the $_GET['submit'] will have a value, then you can know that the form was posted.

Sign up to request clarification or add additional context in comments.

Comments

-1

The submit button will be a successful control if it has been clicked. Check for the existence of a submit key in the form data.

Comments

-1

much easier to use .click() from jQuery to check but add a boolean field for submit in db

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.