Kenny Posted March 18, 2009 Report Posted March 18, 2009 (edited) when submiting info from a php form I built, what would cause 2 emails to be sent one with info and one with out info. Edited March 19, 2009 by Kenny
falkencreative Posted March 19, 2009 Report Posted March 19, 2009 You'll need to post the code, we can't figure this out without it.
Kenny Posted March 19, 2009 Author Report Posted March 19, 2009 (edited) Here is my code. name email <?php $name = $_POST['name']; $email = $_POST['email']; $email_message = "name:{$name} with a email of:{$email}"; mail('kennyfeldman@juno.com','form response',$email_message); ?> Edited March 19, 2009 by Kenny
falkencreative Posted March 20, 2009 Report Posted March 20, 2009 As far as I can tell, according to that code, you are only sending one email (only one mail() statement) so you shouldn't be receiving two email messages.
Wickham Posted March 20, 2009 Report Posted March 20, 2009 There are occasions when an ISP sends double messages - mine has done it several times - when they have a fault with their email system.
Kenny Posted March 22, 2009 Author Report Posted March 22, 2009 Does any one else have any ideas why this is happing?
Kenny Posted April 13, 2009 Author Report Posted April 13, 2009 I called the hosting company and thay seid thair system is working with out any problems. So I did some more Testing and found that is happing in when ever some visits the page with the form on it, with out even touching the form. It shots me a blank email. Can any look at my code and see what is doing this? Thank you.
jlhaslip Posted April 13, 2009 Report Posted April 13, 2009 (edited) There is no conditional checking to see if the Form has been submitted, so as soon as the page is entered, it would send an Email (empty, of course) and then another completed one on Form submission. Try this: > if ( isset($_POST['submitted']) ) { // conditional to check for form submission $name = $_POST['name']; $email = $_POST['email']; $email_message = "name:{$name} with a email of:{$email}"; mail('kennyfeldman@juno.com','form response',$email_message); } ?> </pre> <form id="form1" name="form2" method="post" action="form.php"> name email </form> Added a hidden input that determines the form submission and the conditional for checking is to send the email only when the submit is made. Next you should work on checking to confirm that proper data is submitted and Security code for 'bad input'. That will be the next step. See if this code does what you want and then we can move forward. Edited April 13, 2009 by jlhaslip
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now