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 = "rob@rob.com";

$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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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