Jump to content

php problem I think


halkiede

Recommended Posts

Hi

Would really appreciate if someone can help me out.

 

I have been asked to try get a php enquiry form running asap on a site I did.

I have done a quick testing php enquiry form on my own server from dreamhost which works fine.  Code is below. I have then uploaded the form to the live site which runs on someone elses apache server and it does nothing. looks as though its sent the form but I never receive any email.

I have ran info.php on both sites which can be viewed here:

 

my server were the form runs fine        http://www.testphp.dreamhosters.com/info.php

other server were it doesn't work http://www.seafairhaven.org.uk/info.php

 

enquiry form code

form.html

 

<form method="POST" action="contact.php">

Fields marked (*) are required

 

<p>Email From:* <br>

<input type="text" name="EmailFrom">

<p>Subject: <br>

<input type="text" name="Subject">

<p>BoatName:<br>

<input type="text" name="BoatName">

<p>BoatType:<br>

<input type="text" name="BoatType">

<p>LOA:<br>

<input type="text" name="LOA">

<p>Name:<br>

<input type="text" name="Name">

<p>Address:<br>

<input type="text" name="Address">

<p>Town:<br>

<input type="text" name="Town">

<p>PostCode:<br>

<input type="text" name="PostCode">

<p>Country:<br>

<input type="text" name="Country">

<p>Tel:<br>

<input type="text" name="Tel">

<p>Email:<br>

<input type="text" name="Email">

<p><input type="submit" name="submit" value="Submit">

 

</form>

 

contact.php

 

<?php

 

 

// get posted data into local variables

$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));

$EmailTo = "[email protected]";

$Subject = Trim(stripslashes($_POST['Subject']));

$BoatName = Trim(stripslashes($_POST['BoatName']));

$BoatType = Trim(stripslashes($_POST['BoatType']));

$LOA = Trim(stripslashes($_POST['LOA']));

$Name = Trim(stripslashes($_POST['Name']));

$Address = Trim(stripslashes($_POST['Address']));

$Town = Trim(stripslashes($_POST['Town']));

$PostCode = Trim(stripslashes($_POST['PostCode']));

$Country = Trim(stripslashes($_POST['Country']));

$Tel = Trim(stripslashes($_POST['Tel']));

$Email = Trim(stripslashes($_POST['Email']));

 

// 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 .= "BoatName: ";

$Body .= $BoatName;

$Body .= "\n";

$Body .= "BoatType: ";

$Body .= $BoatType;

$Body .= "\n";

$Body .= "LOA: ";

$Body .= $LOA;

$Body .= "\n";

$Body .= "Name: ";

$Body .= $Name;

$Body .= "\n";

$Body .= "Address: ";

$Body .= $Address;

$Body .= "\n";

$Body .= "Town: ";

$Body .= $Town;

$Body .= "\n";

$Body .= "PostCode: ";

$Body .= $PostCode;

$Body .= "\n";

$Body .= "Country: ";

$Body .= $Country;

$Body .= "\n";

$Body .= "Tel: ";

$Body .= $Tel;

$Body .= "\n";

$Body .= "Email: ";

$Body .= $Email;

$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=index.html\">";

}

else{

  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";

}

?>

 

 

Cheers if anyone can help me.

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.