For example, if you have a image button like
Code:
| <input type="image" name="Submit" value='Register' class="btn" src="images/register_form_btn.jpg" /> |
When the form is submitted via POST. there is nothing for $_POST[’Submit’]. However, you will have $_POST[’Submit_x’] and $_POST[’Submit_y’] that records the x and y coordinates of the click.
You can not do
Code:
| if($_POST['Submit_x'] ) { |
| //do something |
| } |
that’s because a user might press the Enter key to submit the form. In this case, $_POST[’Submit_x’] and $_POST[’Submit_y’] are both 0!!
A convenient solution is to put a hidden field such as
Code:
| <input type='hidden' name='form_sent' value='1'/> |
within the form. Then in your php code
Code:
| if($_POST['form_sent'] ){ |
| //process form |
| } |