mccannio Posted February 7, 2007 Share Posted February 7, 2007 Posted: Wed Feb 07, 2007 9:04 am Post subject: php not working - was working yesterday! please help -------------------------------------------------------------------------------- Hi there, I have been pulling my hair out with this today. It is some code to process a form and then send the results via email. It was working fine yesterday but not it just keeps jumping to the error page! I would really appreciate it if someone could help me! Here is the code <?php $EmailFrom = Trim(stripslashes($_POST['EmailFrom'])); $EmailTo = "[email protected]".","; $Emailto.= $EmailFrom; $Subject = "Photocopier Enquiry"; $ColourCopiers = Trim(stripslashes($_POST['ColourCopiers'])); $BlackandWhiteCopiers = Trim(stripslashes($_POST['BlackandWhiteCopiers'])); $Facsimilies = Trim(stripslashes($_POST['Facsimilies'])); $Purchase = Trim(stripslashes($_POST['Purchase'])); $Lease = Trim(stripslashes($_POST['Lease'])); $Name = Trim(stripslashes($_POST['Name'])); $Company = Trim(stripslashes($_POST['Company'])); $PostCode = Trim(stripslashes($_POST['PostCode'])); $Email = Trim(stripslashes($_POST['EmailFrom'])); $Tel = Trim(stripslashes($_POST['Tel'])); $Message = Trim(stripslashes($_POST['Message'])); $Brochure = Trim(stripslashes($_POST['Brochure'])); $Model = Trim(stripslashes($_POST['Model'])); $validationOK=true; if (Trim($EmailFrom)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } $Body = ""; $Body .= "ColourCopiers: "; $Body .= $ColourCopiers; $Body .= "\n"; $Body .= "BlackandWhiteCopiers: "; $Body .= $BlackandWhiteCopiers; $Body .= "\n"; $Body .= "Facsimilies: "; $Body .= $Facsimilies; $Body .= "\n"; $Body .= "Purchase: "; $Body .= $Purchase; $Body .= "\n"; $Body .= "Lease: "; $Body .= $Lease; $Body .= "\n"; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Company: "; $Body .= $Company; $Body .= "\n"; $Body .= "PostCode: "; $Body .= $PostCode; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Tel: "; $Body .= $Tel; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; $Body .= "Brochure: "; $Body .= $Brochure; $Body .= "\n"; $Body .= "Model: "; $Body .= $Model; $Body .= "\n"; $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.htm\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=contact.php\">"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/37460-php-form-not-working-was-working-yesterday-please-help/ Share on other sites More sharing options...
Hypnos Posted February 7, 2007 Share Posted February 7, 2007 if (Trim($Email)=="") $validationOK=false; Quote Link to comment https://forums.phpfreaks.com/topic/37460-php-form-not-working-was-working-yesterday-please-help/#findComment-179132 Share on other sites More sharing options...
mccannio Posted February 7, 2007 Author Share Posted February 7, 2007 sorry, that didn't make any difference. Quote Link to comment https://forums.phpfreaks.com/topic/37460-php-form-not-working-was-working-yesterday-please-help/#findComment-179140 Share on other sites More sharing options...
.josh Posted February 7, 2007 Share Posted February 7, 2007 your error page is being displayed if $validationOK is false. Your $validationOK is false if trim($EmailFrom) == "". $EmailFrom == "" if trim(stripslashes($_POST['EmailFrom'])) == "". $_POST['EmailFrom'] would == "" for...what reasons? Perhaps there is nothing being input into the EmailFrom form field? Perhaps it is misspelled? btw, it is not necessary to trim something twice. Quote Link to comment https://forums.phpfreaks.com/topic/37460-php-form-not-working-was-working-yesterday-please-help/#findComment-179150 Share on other sites More sharing options...
mccannio Posted February 7, 2007 Author Share Posted February 7, 2007 any suggestions anyone? Quote Link to comment https://forums.phpfreaks.com/topic/37460-php-form-not-working-was-working-yesterday-please-help/#findComment-179234 Share on other sites More sharing options...
.josh Posted February 7, 2007 Share Posted February 7, 2007 did you try my suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/37460-php-form-not-working-was-working-yesterday-please-help/#findComment-179258 Share on other sites More sharing options...
The Little Guy Posted February 7, 2007 Share Posted February 7, 2007 I'm not sure if this will have any difference, but it is worth a shot. <?php if (mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>")){ print "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.htm\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=contact.php\">"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/37460-php-form-not-working-was-working-yesterday-please-help/#findComment-179260 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.