Jump to content

[SOLVED] Contact Forms & Wordpress


macca81625

Recommended Posts

Hi guys, im new to this forum, so if this problem has been addressed, please let me know but its got me  :facewall:

 

I have a contact form, www webuynow co uk it has worked in the past, and I've tried to alter the form to work on the why us page, thats how i found this problem, but now all i am getting is a blank page after submitting!

 

I dont know if its linked to the fact that I installed wordpress, here is my php code!

 

<?php
// Website Contact Form Generator 
// http://www.tele-pro.co.uk/scripts/contact_form/ 
// This script is free to use as long as you  
// retain the credit link  

// get posted data into local variables
$EmailFrom = "[email protected]";
$EmailTo = "[email protected]";
$Subject = "Inquiry";
$Name = Trim(stripslashes($_POST['Name'])); 
$Telephone = Trim(stripslashes($_POST['Telephone'])); 
$Make = Trim(stripslashes($_POST['Make'])); 
$Model = Trim(stripslashes($_POST['Model'])); 
$Colour = Trim(stripslashes($_POST['Colour'])); 
$Registration = Trim(stripslashes($_POST['Registration'])); 
$Year = Trim(stripslashes($_POST['Year'])); 
$Mileage = Trim(stripslashes($_POST['Mileage'])); 
$attn = Trim(stripslashes($_POST['attn']));
$attn1 = Trim(stripslashes($_POST['attn1']));





// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Telephone: ";
$Body .= $Telephone;
$Body .= "\n";
$Body .= "Make: ";
$Body .= $Make;
$Body .= "\n";
$Body .= "Model: ";
$Body .= $Model;
$Body .= "\n";
$Body .= "Engine: ";
$Body .= $Colour;
$Body .= "\n";
$Body .= "Registration: ";
$Body .= $Registration;
$Body .= "\n";
$Body .= "Year: ";
$Body .= $Year;
$Body .= "\n";
$Body .= "Mileage: ";
$Body .= $Mileage;
$Body .= "\n";
$Body .= "V5: ";
$Body .= $attn;
$Body .= "\n";
$Body .= "Transmission: ";
$Body .= $attn1;
$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=thankyouside.php\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.php">";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/168708-solved-contact-forms-wordpress/
Share on other sites

forgot to escape a quote:

<?php
// Website Contact Form Generator 
// http://www.tele-pro.co.uk/scripts/contact_form/ 
// This script is free to use as long as you  
// retain the credit link  

// get posted data into local variables
$EmailFrom = "[email protected]";
$EmailTo = "[email protected]";
$Subject = "Inquiry";
$Name = Trim(stripslashes($_POST['Name'])); 
$Telephone = Trim(stripslashes($_POST['Telephone'])); 
$Make = Trim(stripslashes($_POST['Make'])); 
$Model = Trim(stripslashes($_POST['Model'])); 
$Colour = Trim(stripslashes($_POST['Colour'])); 
$Registration = Trim(stripslashes($_POST['Registration'])); 
$Year = Trim(stripslashes($_POST['Year'])); 
$Mileage = Trim(stripslashes($_POST['Mileage'])); 
$attn = Trim(stripslashes($_POST['attn']));
$attn1 = Trim(stripslashes($_POST['attn1']));





// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Telephone: ";
$Body .= $Telephone;
$Body .= "\n";
$Body .= "Make: ";
$Body .= $Make;
$Body .= "\n";
$Body .= "Model: ";
$Body .= $Model;
$Body .= "\n";
$Body .= "Engine: ";
$Body .= $Colour;
$Body .= "\n";
$Body .= "Registration: ";
$Body .= $Registration;
$Body .= "\n";
$Body .= "Year: ";
$Body .= $Year;
$Body .= "\n";
$Body .= "Mileage: ";
$Body .= $Mileage;
$Body .= "\n";
$Body .= "V5: ";
$Body .= $attn;
$Body .= "\n";
$Body .= "Transmission: ";
$Body .= $attn1;
$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=thankyouside.php\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.php\">";
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.