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", "[email protected]");

$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 = "[email protected]"; // Hidden for posting purposes
$host_email = "[email protected]"; //Again hidden for posting purposes
$email = "[email protected]"; // 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
https://forums.phpfreaks.com/topic/122225-solved-contact-form-producing-errors/
Share on other sites

Try reading the error

 

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

 

What does it mean??

The var is undefined, it doesnt exist.

 

Show the code for the form.

 

 

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>

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>

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.