I have a bit of PHP code with an HTML Form that POSTS to itself, and I really would like to know how I can tell if the Submit Button has be pressed or the Form has been submitted. I have this snippet of code which (supposedly?) checks to see if the Button has been pressed. If I open the form initially, then it returns "No". If I press the button, it returns "Yes". Great, I thought! However if I just refresh the page, obviously without pressing the button, it STILL returns "Yes". Is there an easier or better way of checking this? Thanks in advance.
Can we see your snippet of code?
if your button looks like this
<input type="submit" name="submit" value="submit">
you can simply check to see if its been hit like this:
</php if (isset($_POST['submit'])) { // your form has been sent, do proccessing } ?>
Sorry about that! I had it ready, but forgot to paste it in. Here is the main bit...
$frm_button = $_POST[submit_form];
//$button = "No"; if(isset($frm_button)){ $button = "Yes"; } else if(!isset($frm_button)){ $button = "No"; }
Terry