I have a php page (horses.php) that includes:
<?php require_once('send_email.php');?>
What happens is I have some scripting to send an email (and do some other things) in the send_email.php file.
Now when horses.php loads the send_email.php page triggers and sends an email. It works perfectly. But on horses.php I also have a submit button that updates a db and goes to anoher page.. But what happens is that the send_email.php seems to be triggered on page load and also on submit? Because I get an email on page load (as I should), but then also when I press submit??
Ideas around this?
Thanks
You could try only sending the email if the form hasn’t been submitted: