gk01 Posted May 2, 2010 Share Posted May 2, 2010 hey guys, I need to know how to have the details of my registration form go to an email address without having to pass through a db. Im guessing my employers want to selectivley store data info of the registering clients to then offer them other service packages, however, my job is developing the php code behind it together with its requisit documentation. so below is a script for the form being proposed, followed by the script i've attempted to execute...but i keep failing... can someone please help me out?!! by the way im using CS4...and bare with my lack of knowledge for my php code At least have me send these details to someones email adress and then i can look for someone to help me with the validation Script for form.....and where does tha java script go...and how does it work <form method="post" name="cio" action="whynot.php"> <table width="100%" border="0" cellspacing="0" cellpadding="4" style="font-family:Arial, Helvetica, sans-serif; font-size:12px;"> <tr> <td width="124">Surname</td> <td width="366"><input type="text" name="Surname" id="textfield" /></td> <td width="119">Other Names</td> <td width="239"><input type="text" name="Other_Names" id="Other_Names" /></td> </tr> <tr> <td>Designation</td> <td><input type="text" name="Designation" id="Designation" /></td> <td> </td> <td> </td> </tr> <tr> <td>Company</td> <td><input type="text" name="Company" id="Company" /></td> <td> </td> <td> </td> </tr> <tr> <td>Physical Address</td> <td><input type="text" name="Physical_Address" id="Physical_Address" /></td> <td> </td> <td> </td> </tr> <tr> <td>Postal Address</td> <td><input type="text" name="Postal_Address" id="Postal_Address" /></td> <td> </td> <td> </td> </tr> <tr> <td>Postal Code</td> <td><input type="text" name="Postal_Code" id="Postal_Code" /></td> <td>City/Town</td> <td><input type="text" name="City_Town" id="City_Town" /></td> </tr> <tr> <td>Country</td> <td><input type="text" name="Country" id="Country" /></td> <td>Region</td> <td><input type="text" name="Region" id="Region" /></td> </tr> <tr> <td>Tel(Home):</td> <td><input type="text" name="Tel_Home" id="Tel_Home" /></td> <td>Tel(Work):</td> <td><input type="text" name="Tel_Work" id="Tel_Work" /></td> </tr> <tr> <td>Fax</td> <td><input type="text" name="Fax" id="Fax" /></td> <td>CellPhone</td> <td><input type="text" name="CellPhone" id="CellPhone" /></td> </tr> <tr> <td>Email(Personal):</td> <td><input type="text" name="Email_Personal" id="Email_Personal" /></td> <td>Email(Work):</td> <td><input type="text" name="Email_Work" id="Email_Work" /></td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> <table width="760" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="395" height="51"> </td> <td width="365"><input type="submit" onClick="return confirm('Send form?');" name="form_submitted_successfully" value="Submit" /> <label> <input type="reset" name="CANCEL" id="CANCEL"> </label></td> </tr> </table> <p> </p> </form></td> </tr> </table></td> </tr> </table> </td> </tr> </table> my attempted script.. <?php ///so whats wrong...i thought its gonna post all these details in the order i've specified here!! $Surname = $_POST['Surname']; $Other_Names = $_POST['Other_Names']; $Designation = $_POST['Designation']; $Company = $_POST['Company']; $Physical_Address = $_POST['Physical_Address']; $Postal_Address = $_POST['Postal_Address']; $Postal_Code = $_POST['Postal_Code']; $City_Town = $_POST['City_Town']; $Country = $_POST['Country']; $Region = $_POST['Region']; $Tel_Home = $_POST['Tel_Home']; $Tel_Work = $_POST['Tel_Work']; $Fax = $_POST['Fax']; $CellPhone = $_POST['CellPhone']; $Email_Personal = $_POST['Email_Personal']; $Email_Work = $_POST['Email_Work']; $email_from = '[email protected]'; $email_subject = "testing breakfast-launch for cio"; $email_body = "you have recived an event registration from $Surname.\n". "Here are his details:\n $message". //change the way this shit is presented $to = "[email protected]"; $headers = "From: $email_from \r\n"; $headers .= "Reply-To: $Personal_Email \r\n"; mail($to,$email_subject,$email_body,$headers); header('Location: thanks.html'); // Function to validate against any email injection attempts///the fuck //function IsInjected($str) //{ // $injections = array('(\n+)', // '(\r+)', // '(\t+)', // '(%0A+)', // '(%0D+)', // '(%08+)', // '(%09+)' // ); // $inject = join('|', $injections); // $inject = "/$inject/i"; // if(preg_match($inject,$str)) // { // return true; // } // else // { // return false; // } //} ?> [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/200471-how-to-form-2-mail/ Share on other sites More sharing options...
ialsoagree Posted May 2, 2010 Share Posted May 2, 2010 Well, for one thing... $email_body = "you have recived an event registration from $Surname.\n". "Here are his details:\n $message". //change the way this shit is presented ...doesn't have a colon after the closing quotation: $message". // There may be other things wrong, but that should cause a parse error. Link to comment https://forums.phpfreaks.com/topic/200471-how-to-form-2-mail/#findComment-1052067 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.