Jump to content

[SOLVED] Contact Form Producing Errors


stublackett

Recommended Posts

Help.......

 

I've got a PHP Contact Form and the message that the end user receieves is full of Errors

 

Its saying this :

 

The following was sent on 01/09/08(Mon) @ 14:15 from IP ...BLANKED OUT...

---------------------------------------------------------

Name : <br />

<b>Notice</b>:  Undefined variable: name in <b>\\nas31ent\domains\s\sunningdale-hotel.com\user\htdocs\contact.php</b> on line <b>105</b><br />

 

E-mail : <br />

<b>Notice</b>:  Undefined variable: e_mail in <b>\\nas31ent\domains\s\sunningdale-hotel.com\user\htdocs\contact.php</b> on line <b>106</b><br />

 

Telephone : <br />

<b>Notice</b>:  Undefined variable: tel in <b>\\nas31ent\domains\s\sunningdale-hotel.com\user\htdocs\contact.php</b> on line <b>107</b><br />

 

The code for the form is :

 

<?php

ini_set("sendmail_from", "enquiries@sunningdale-hotel.com");

$post_message = "0"; 

if ($_SERVER['REQUEST_METHOD'] == "POST")
{
$post_message = "1";

$name = $_POST['name'];
$e_mail = $_POST['e_mail'];
$tel = $_POST['tel'];
$enquiry = $_POST['enquiry'];

//	$host_email = "user@user.com"; // Hidden for posting purposes
$host_email = "user@user.com"; //Again hidden for posting purposes
$email = "user@user.com"; // Same as above
$subject = "The Sunningdale-hotel.com Enquiry";
$TimeOfMessage = date('d')."/".date('m')."/".date('y')."(".date('D').") @ ".date('H:i');
$ip = $_SERVER["REMOTE_ADDR"];

$message = "The following was sent on " .$TimeOfMessage." from IP " .$ip. "\n";
    $message .= "---------------------------------------------------------\n";
    $message .= "Name : " .$name. "\n";
$message .= "E-mail : " .$e_mail. "\n";
$message .= "Telephone : " .$tel. "\n";
$message .= "Enquiry : " .$enquiry. "\n";

mail($host_email, $subject, $message, "From: $name <$e_mail>");

}
?>

 

Link to comment
Share on other sites

My suspicions are with the form itself, Yeah

 

The variables are being set by the $_POST so the error should not be occuring, Like you say there is something in the form, If you can see what it is, Much appreciated :)

 

<form name="signup" action="contact.php" method="POST">
<table align="center">
<tr>
<td colspan="2" style="height: 5px"></td>
</tr>
<tr>
<td class="labelcell">Name:</td>
<td class="fieldcell"><input name="name" id="name" type="text" tabindex="1" /></td>
</tr>
<tr>
<td class="labelcell">E-mail:</td>
<td class="fieldcell"><input name="e_mail" id="e_mail" type="text" tabindex="2" /></td>
</tr>
<tr>
<td class="labelcell">Telephone:</td>
<td class="fieldcell"><input name="tel" id="tel" type="text" tabindex="3" /></td>
</tr>
<tr>
<td class="labelcell" valign="top">Enquiry:</td>
<td align="center">
<textarea name="enquiry" id="enquiry" tabindex="4"></textarea>
<input name="name" type="hidden" value="<?php echo $name; ?>" />
<input name="e_mail" type="hidden" value="<?php echo $e_mail; ?>" />
<input name="tel" type="hidden" value="<?php echo $tel ; ?>" />
<br />
<br />
<input name="Submit" type="submit" value="Submit" class="buttons" tabindex="5"/> <input name="Reset" type="reset" value="Reset"  class="buttons" tabindex="6" />				
</td>
</tr>
<tr>
<td class="labelcell2" colspan="2"><input name="Offers" type="checkbox" id="Offers" value="Sign Up" checked="checked" />
I would like to recieve email updates on special offers</td>
</tr>
<tr>
</tr>
</table>
</form>

Link to comment
Share on other sites

oops, needed a bit more but no there not neaded , try this

 

 

<td class="labelcell">Name:</td>

<td class="fieldcell"><input name="name" id="name" type="text" tabindex="1" value="<?php if(isset($_POST['name'])){echo $_POST['name'];}" /></td>

</tr>

<tr>

<td class="labelcell">E-mail:</td>

<td class="fieldcell"><input name="e_mail" id="e_mail" type="text" tabindex="2" value="<?php if(isset($_POST['e_mail'])){echo $_POST['e_mail'];}"  /></td>

</tr>

<tr>

<td class="labelcell">Telephone:</td>

<td class="fieldcell"><input name="tel" id="tel" type="text" tabindex="3" value="<?php if(isset($_POST['tel'])){echo $_POST['tel'];}"  /></td>

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.