saltem8 Posted May 23, 2007 Share Posted May 23, 2007 i have this <form method="POST" action="php/contact.php"> Fields marked (*) are required <table cellspacing="5" cellpadding="5" border="0"> <tr> <td valign="top"><strong>*Full Name:</strong> </td> <td valign="top"><input type="text" name="FullName" size="40" value="" /> </td> </tr> <tr> <td valign="top"><strong>*Email Address:</strong> </td> <td valign="top"><input type="text" name="EmailAddress" size="40" value="" /> </td> </tr> <tr> <td valign="top"><strong>Address:</strong> </td> <td valign="top"><input type="text" name="Address" size="40" value="" /> </td> </tr> <tr> <td valign="top"><strong>city/town:</strong> </td> <td valign="top"><input type="text" name="citytown" size="40" value="" /> </td> </tr> <tr> <td valign="top"><strong>Region:</strong> </td> <td valign="top"><input type="text" name="Region" size="40" value="" /> </td> </tr> <tr> <td valign="top"><strong>Postcode/Zip:</strong> </td> <td valign="top"><input type="text" name="PostcodeZip" size="40" value="" /> </td> </tr> <tr> <td valign="top"><strong>*Telephone:</strong> </td> <td valign="top"><input type="text" name="Telephone" size="40" /> </td> </tr> <tr> <td valign="top"><strong> Current Website URL:</strong> ( if applicable ) </td> <td valign="top"><input type="text" name="CurrentWebsiteURL" size="40" value="http://" /> </td> </tr> <tr> <td valign="top"><strong>Company Name:</strong> ( if applicable ) </td> <td valign="top"><input type="text" name="CompanyName" size="40" value="" /> </td> </tr> <tr> <td valign="top"><strong>Referral:</strong> </td> <td valign="top"><select name="Referral" > <option value="HowyouHeardAboutUs ">How you Heard About Us </option> <option value="ClientReferral ">Client Referral </option> <option value="PrintAdd ">Print Add </option> <option value="VehicleAdd ">Vehicle Add </option> <option value="GoogleSearch ">Google Search </option> <option value="YahooSearch ">Yahoo Search </option> <option value="OtherSearch ">Other Search </option> <option value="FreelanceDesignersSite ">Freelance Designers Site </option> <option value="MarketingToolSite ">Marketing Tool Site </option> <option value="DesignFirmsSite ">Design Firms Site </option> <option value="WebsiteDesign DirectorySite ">Website Design Directory Site </option> <option value="Other">Other</option> </select> </td> </tr> <tr> <td valign="top"><strong>*Department:</strong> </td> <td valign="top"><select name="Department"> <option value="SalesDepartment ">Sales Department </option> <option value="DesignService ">Design Service </option> <option value="HostingService ">Hosting Service </option> <option value="Billing ">Billing </option> <option value="TechSupport ">Tech Support </option> <option value=""></option> </select> </td> </tr> <tr> <td valign="top"><strong>*Do You Currently Have Hosting:</strong></td> <td valign="top"><input type="radio" name="yes" value="Yes " /> Yes <br/> <input type="radio" name="no" value="No" /> No<br/> </td> </tr> <tr> <td valign="top"><strong>*Message:</strong> ( please give us as much information as possible, as this will speed up the design process ) </td> <td valign="top"><textarea name="Message" rows="6" cols="40"></textarea> </td> </tr> <tr> <td colspan="2" align="center"><div align="right"> <input name="submit" type="submit" value=" Submit Form " /> </div></td> </tr> </table > </form> and this <?php // get posted data into local variables $EmailFrom = Trim(stripslashes($_POST['EmailFrom'])); $EmailTo = "my email address"; $Subject = Trim(stripslashes($_POST['Subject'])); $FullName = Trim(stripslashes($_POST['FullName'])); $EmailAddress = Trim(stripslashes($_POST['EmailAddress'])); $Address = Trim(stripslashes($_POST['Address'])); $citytown = Trim(stripslashes($_POST['citytown'])); $Region = Trim(stripslashes($_POST['Region'])); $PostcodeZip = Trim(stripslashes($_POST['PostcodeZip'])); $Telephone = Trim(stripslashes($_POST['Telephone'])); $CurrentWebsiteURL = Trim(stripslashes($_POST['CurrentWebsiteURL'])); $CompanyName = Trim(stripslashes($_POST['CompanyName'])); $Referral = Trim(stripslashes($_POST['Referral'])); $HowyouHeardAboutUs = Trim(stripslashes($_POST['HowyouHeardAboutUs'])); $ClientReferral = Trim(stripslashes($_POST['ClientReferral'])); $PrintAdd = Trim(stripslashes($_POST['PrintAdd'])); $VehicleAdd = Trim(stripslashes($_POST['VehicleAdd'])); $GoogleSearch = Trim(stripslashes($_POST['GoogleSearch'])); $YahooSearch = Trim(stripslashes($_POST['YahooSearch'])); $OtherSearch = Trim(stripslashes($_POST['OtherSearch'])); $FreelanceDesignersSite = Trim(stripslashes($_POST['FreelanceDesignersSite'])); $DesignFirmsSite = Trim(stripslashes($_POST['DesignFirmsSite'])); $WebsiteDesignDirectorySite = Trim(stripslashes($_POST['WebsiteDesignDirectorySite'])); $Other = Trim(stripslashes($_POST['Other'])); $CurrentWebsiteURL = Trim(stripslashes($_POST['CurrentWebsiteURL'])); $Department = Trim(stripslashes($_POST['Department'])); $SalesDepartment = Trim(stripslashes($_POST['SalesDepartment'])); $HowyouHeardAboutUs = Trim(stripslashes($_POST['HowyouHeardAboutUs'])); $DesignService = Trim(stripslashes($_POST['DesignService'])); $HostingService = Trim(stripslashes($_POST['HostingService'])); $Billing = Trim(stripslashes($_POST['Billing'])); $TechSupport = Trim(stripslashes($_POST['TechSupport'])); $DoYouCurrentlyHaveHosting = Trim(stripslashes($_POST['DoYouCurrentlyHaveHosting'])); $Yes = Trim(stripslashes($_POST['Yes'])); $No = Trim(stripslashes($_POST['No'])); $Message = Trim(stripslashes($_POST['Message'])); // validation $validationOK=true; if (Trim($EmailFrom)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "FullName: "; $Body .= $FullName; $Body .= "\n"; $Body .= "EmailAddress: "; $Body .= $EmailAddress; $Body .= "\n"; $Body .= "Address: "; $Body .= $Address; $Body .= "\n"; $Body .= "citytown: "; $Body .= $citytown; $Body .= "\n"; $Body = ""; $Body .= "Region: "; $Body .= $Region; $Body .= "\n"; $Body .= "PostcodeZip: "; $Body .= $PostcodeZip; $Body .= "\n"; $Body .= "Telephone: "; $Body .= $Telephone; $Body .= "\n"; $Body .= "CurrentWebsiteURL: "; $Body .= $CurrentWebsiteURL; $Body .= "\n"; $Body = ""; $Body .= "CompanyName: "; $Body .= $CompanyName; $Body .= "\n"; $Body .= "Referral: "; $Body .= $Referral; $Body .= "\n"; $Body .= "HowyouHeardAboutUs: "; $Body .= $HowyouHeardAboutUs; $Body .= "\n"; $Body .= "ClientReferral: "; $Body .= $ClientReferral; $Body .= "\n"; $Body = ""; $Body .= "PrintAdd: "; $Body .= $PrintAdd; $Body .= "\n"; $Body .= "FirstName: "; $Body .= $FirstName; $Body .= "\n"; $Body .= "Mobile: "; $Body .= $Mobile; $Body .= "\n"; $Body .= "Company: "; $Body .= $Company; $Body .= "\n"; $Body = ""; $Body .= "VehicleAdd: "; $Body .= $VehicleAdd; $Body .= "\n"; $Body .= "GoogleSearch: "; $Body .= $GoogleSearch; $Body .= "\n"; $Body .= "YahooSearch: "; $Body .= $YahooSearch; $Body .= "\n"; $Body .= "OtherSearch: "; $Body .= $OtherSearch; $Body .= "\n"; $Body = ""; $Body .= "FreelanceDesignersSite: "; $Body .= $FreelanceDesignersSite; $Body .= "\n"; $Body .= "DesignFirmsSite: "; $Body .= $DesignFirmsSite; $Body .= "\n"; $Body .= "WebsiteDesignDirectorySite: "; $Body .= $WebsiteDesignDirectorySite; $Body .= "\n"; $Body .= "WebsiteDesignDirectorySite: "; $Body .= $WebsiteDesignDirectorySite; $Body .= "\n"; $Body = ""; $Body .= "Other: "; $Body .= $Other; $Body .= "\n"; $Body .= "CurrentWebsiteURL: "; $Body .= $CurrentWebsiteURL; $Body .= "\n"; $Body .= "Department: "; $Body .= $Department; $Body .= "\n"; $Body .= "SalesDepartment: "; $Body .= $SalesDepartment; $Body .= "\n"; $Body = ""; $Body .= "HowyouHeardAboutUs: "; $Body .= $HowyouHeardAboutUs; $Body .= "\n"; $Body .= "DesignService: "; $Body .= $DesignService; $Body .= "\n"; $Body .= "HostingService: "; $Body .= $HostingService; $Body .= "\n"; $Body .= "Billing: "; $Body .= $Billing; $Body .= "\n"; $Body = ""; $Body .= "TechSupport: "; $Body .= $TechSupport; $Body .= "\n"; $Body .= "DoYouCurrentlyHaveHosting: "; $Body .= $DoYouCurrentlyHaveHosting; $Body .= "\n"; $Body .= "Yes: "; $Body .= $Yes; $Body .= "\n"; $Body .= "No: "; $Body .= $No; $Body .= "\n"; $Body = ""; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> and it keeps sending me to the error page, can anyone tell me what is wrong ?, p.s i know nothing of php, this script is an extention of a free one its here http://www.fmat.co.uk/email.html thank you Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted May 23, 2007 Share Posted May 23, 2007 What error is it giving you? and please copy and paste the error here. don't try and summarise it, as it can make it difficult for others to understand ^^ Regards ACE Quote Link to comment Share on other sites More sharing options...
saltem8 Posted May 23, 2007 Author Share Posted May 23, 2007 i put this in ini_set('error_reporting', E_ALL); and it returned Notice: Undefined index: EmailFrom in /home/xspeople/public_html/php/contact.php on line 4 Notice: Undefined index: Subject in /home/xspeople/public_html/php/contact.php on line 6 Notice: Undefined index: HowyouHeardAboutUs in /home/xspeople/public_html/php/contact.php on line 17 Notice: Undefined index: ClientReferral in /home/xspeople/public_html/php/contact.php on line 18 Notice: Undefined index: PrintAdd in /home/xspeople/public_html/php/contact.php on line 19 Notice: Undefined index: VehicleAdd in /home/xspeople/public_html/php/contact.php on line 20 Notice: Undefined index: GoogleSearch in /home/xspeople/public_html/php/contact.php on line 21 Notice: Undefined index: YahooSearch in /home/xspeople/public_html/php/contact.php on line 22 Notice: Undefined index: OtherSearch in /home/xspeople/public_html/php/contact.php on line 23 Notice: Undefined index: FreelanceDesignersSite in /home/xspeople/public_html/php/contact.php on line 24 Notice: Undefined index: DesignFirmsSite in /home/xspeople/public_html/php/contact.php on line 25 Notice: Undefined index: WebsiteDesignDirectorySite in /home/xspeople/public_html/php/contact.php on line 26 Notice: Undefined index: Other in /home/xspeople/public_html/php/contact.php on line 27 Notice: Undefined index: SalesDepartment in /home/xspeople/public_html/php/contact.php on line 30 Notice: Undefined index: HowyouHeardAboutUs in /home/xspeople/public_html/php/contact.php on line 31 Notice: Undefined index: DesignService in /home/xspeople/public_html/php/contact.php on line 32 Notice: Undefined index: HostingService in /home/xspeople/public_html/php/contact.php on line 33 Notice: Undefined index: Billing in /home/xspeople/public_html/php/contact.php on line 34 Notice: Undefined index: TechSupport in /home/xspeople/public_html/php/contact.php on line 35 Notice: Undefined index: DoYouCurrentlyHaveHosting in /home/xspeople/public_html/php/contact.php on line 36 Notice: Undefined index: Yes in /home/xspeople/public_html/php/contact.php on line 37 Notice: Undefined index: No in /home/xspeople/public_html/php/contact.php on line 38 Notice: Undefined variable: FirstName in /home/xspeople/public_html/php/contact.php on line 88 Notice: Undefined variable: Mobile in /home/xspeople/public_html/php/contact.php on line 91 Notice: Undefined variable: Company in /home/xspeople/public_html/php/contact.php on line 94 i am not getting any other error, its just re-directing me to the error.htm Quote Link to comment Share on other sites More sharing options...
cluce Posted May 23, 2007 Share Posted May 23, 2007 try using this to help guide you in the email form. I am new to php and I found these tutorials to be very helpful. I usually start with a simple exercise before I do a more complex form. http://www.w3schools.com/php/php_mail.asp Quote Link to comment Share on other sites More sharing options...
saltem8 Posted May 23, 2007 Author Share Posted May 23, 2007 i think the problem is the drop down boxes, once i have this form working, i will be able to create forms forever more, i just dont understand tutorials 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.