Kenny Posted March 18, 2009 Report Share 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 Quote Link to comment Share on other sites More sharing options...
falkencreative Posted March 19, 2009 Report Share Posted March 19, 2009 You'll need to post the code, we can't figure this out without it. Quote Link to comment Share on other sites More sharing options...
Kenny Posted March 19, 2009 Author Report Share 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 Quote Link to comment Share on other sites More sharing options...
falkencreative Posted March 20, 2009 Report Share 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. Quote Link to comment Share on other sites More sharing options...
Wickham Posted March 20, 2009 Report Share 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. Quote Link to comment Share on other sites More sharing options...
Kenny Posted March 22, 2009 Author Report Share Posted March 22, 2009 Does any one else have any ideas why this is happing? Quote Link to comment Share on other sites More sharing options...
Kenny Posted April 13, 2009 Author Report Share 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. Quote Link to comment Share on other sites More sharing options...
jlhaslip Posted April 13, 2009 Report Share 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.