Jump to content

mccannio

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mccannio's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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 = "paul.mccann@firstfound.co.uk".","; $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\">"; } ?>
  2. Hi there, I hope someone can help me. I am in the process of completing a new site [a href=\"http://www.loans4northern-ireland.co.uk\" target=\"_blank\"]http://www.loans4northern-ireland.co.uk[/a] . The small form will not send an email and I cannot see where I am going wrong (maybe cos i've been looking at it all weekend and cant see straight anymore!) the form info is here: <tr> <td><form action="sendresults.php" method="post" name="form1"> <table width="350" border="0" cellspacing="5" cellpadding="0"> <tr> <td width="105">Full Name</td> <td width="16">:</td> <td width="222"><input name="fullname" type="text" id="fullname"> * </td> </tr> <tr> <td>E-mail</td> <td>:</td> <td><input name="email" type="text" id="email"> * </td> </tr> <tr> <td>Phone number </td> <td>:</td> <td><input name="phone_number" type="text" id="phone_number"> * </td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td><input type="submit" name="Submit" value="Submit"> </td> </tr> </table> </form></td> </tr> the form submits results to sendresults.php. The redirect works fine but it has just stopped sending the confirmation email. here is the php code <?php //--------------------------Set these paramaters-------------------------- // Subject of email sent to you. $subject = 'Results from Contact form'; // Your email address. This is where the form information will be sent. $emailadd = 'paul@loans4northern-ireland.co.uk'; // Where to redirect after form is processed. $url = 'http://www.loans4northern-ireland.co.uk'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty. $req = '0'; // --------------------------Do not edit below this line-------------------------- $text = "Results from form:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 20) {echo "Name of form element $key cannot be longer than 20 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } mail($emailadd, $subject, $text, 'From: '.$emailadd.''); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; ?> thanks sorry about all the code, but i'm not sure where the error actually occurs ! (it worked fine when testing but when i moved it to main site thats when problem happened)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.