aebstract Posted March 1, 2010 Share Posted March 1, 2010 <?php if (isset($_POST['submit'])){ if (empty ($_POST['firstname'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['lastname'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['address'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['city'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['state'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['zip'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['phone1'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['phone2'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['phone3'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['classdropdown'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif ($_POST['classdropdown'] == Classes) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['carnumber'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['makemodel'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } elseif (empty ($_POST['email'])) { $problem = TRUE; $error .= 'All fields are required to be fully filled out.'; } if (!$problem) { $emailbody = " ORSCA REGISTRATION FORM<br /><br /> <table> <tr> <td> Name: </td><td> </td><td> $_POST[firstname] $_POST[lastname] </td></tr> <tr><td> Email: </td><td> </td><td> $_POST[email] </td></tr> <tr><td> Phone Number: </td><td> </td><td> ($_POST[phone1]) $_POST[phone2] - $_POST[phone3] </td></tr> </table> $_POST[address]<br /> $_POST[city], $_POST[state] $_POST[zip]<br /><br /> $_POST[makemodel]<br /> $_POST[classdropdown]<br /> $_POST[carnumber] "; $to = '[email protected]' . ', '; // note the comma // subject $subject = 'ORSCA Registration Form'; // message $message = " <html> <head> </head> <body> $emailbody </body> </html> "; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: ORSCA <[email protected]>' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); } } $content .= " <div id=\"content\"> $error <form action=\"index.php?page=registration2\" method=\"post\" name=\"registration\"> <table><tr><td class=\"rtable1\"> Name: </td><td class=\"tablespace\"> </td><td> <input type=\"text\" maxlength=\"20\" class=\"textfield\" name=\"firstname\" value=\"$_POST[firstname]\" size=\"7\" /> <input type=\"text\" maxlength=\"20\" class=\"textfield\" name=\"lastname\" value=\"$_POST[lastname]\" size=\"10\" /> </td></tr> <tr><td class=\"rtable1\"> Address: </td><td class=\"tablespace\"> </td><td> <input type=\"text\" maxlength=\"60\" class=\"textfield\" name=\"address\" value=\"$_POST[address]\" size=\"20\" /><br /> <input type=\"text\" maxlength=\"30\" class=\"textfield\" name=\"city\" value=\"$_POST[city]\" size=\"10\" />, <input type=\"text\" maxlength=\"2\" class=\"textfield\" style=\"text-transform: uppercase; text-align:center;\" name=\"state\" value=\"$_POST[state]\" size=\"1\" /> <input type=\"text\" maxlength=\"5\" class=\"textfield\" style=\"text-align: center;\" name=\"zip\" value=\"$_POST[zip]\" size=\"2\" /> </td></tr> <tr><td class=\"rtable1\"> Phone Number: </td><td class=\"tablespace\"> </td><td> <input type=\"text\" maxlength=\"3\" class=\"textfieldp\" name=\"phone1\" value=\"$_POST[phone1]\" size=\"1\" /><input type=\"text\" maxlength=\"3\" class=\"textfieldp\" name=\"phone2\" value=\"$_POST[phone2]\" size=\"1\" /><input type=\"text\" maxlength=\"4\" class=\"textfieldp\" name=\"phone3\" value=\"$_POST[phone3]\" size=\"2\" /> </td></tr> <tr><td class=\"rtable1\"> Racing Class: </td><td class=\"tablespace\"> </td><td> <select name=\"classdropdown\"> <option style=\"text-align: center; border-bottom: 1px solid #000; margin-bottom: 10px; padding-bottom: 5px;\">Classes</option> <option value=\"outlaw105\">Outlaw 10.5</option> <option value=\"limitedstreet\">Limited Street</option> <option value=\"ezstreet\">EZ Street</option> <option value=\"realstreet\">Real Street</option> <option value=\"modifiedstreet\">Modified Street</option> <option value=\"470index\">4.70 Index</option> <option value=\"530index\">5.30 Index</option> <option value=\"600index\">6.00 Index</option> <option value=\"700index\">7.00 Index</option> </select> </td></tr> <tr><td class=\"rtable1\"> Desired Car Number: </td><td class=\"tablespace\"> </td><td> <input type=\"text\" maxlength=\"10\" class=\"textfield\" name=\"carnumber\" value=\"$_POST[carnumber]\" size=\"5\" /> </td></tr> <tr><td class=\"rtable1\"> Vehicle Make/Model: </td><td class=\"tablespace\"> </td><td> <input type=\"text\" maxlength=\"50\" class=\"textfield\" name=\"makemodel\" value=\"$_POST[makemodel]\" size=\"20\" /> </td></tr> <tr><td class=\"rtable1\"> Email Address: </td><td class=\"tablespace\"> </td><td> <input type=\"text\" maxlength=\"50\" class=\"textfield\" name=\"email\" value=\"$_POST[email]\" size=\"30\" /> </td></tr> </table> <input type=\"submit\" name=\"submit\" class=\"textfield\" value=\"Send Registration\" /> </form> </div> "; ?> Any idea why the email is sending twice? Link to comment https://forums.phpfreaks.com/topic/193822-email-is-sending-twice/ Share on other sites More sharing options...
schilly Posted March 1, 2010 Share Posted March 1, 2010 you have an email address in the $to variable and also your $headers variable. if you look at the headers of your email you will see two TO: fields. Link to comment https://forums.phpfreaks.com/topic/193822-email-is-sending-twice/#findComment-1020151 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.