Join Login


 Contact Form tutorial problem
 by The pokemon kid - Oct 17, 2011

Heya,

I followed the tutorial to make the contact form.

http://www.youtube.com/watch?v=cLYUhH_T3S0

I cheated a little and used a template to make it look a little nice. http://www.mantisatemplates.com/free-html-css-forms.php. I used the "Various" - "higher" one. Its pretty much the same one which was made in the tutorial except for a CSS styling behind it...

I followed the guide to the tee and I uploaded it onto the server and it wont work. I split the PHP and the html into two separate files. As many other tutorials did.

The website is currently at: "http://www.teaguephotography.co.uk/Contact.html"

The code for the HTML page is:





<form id="Contactform" name="Contactform" method="post" action="ContactForm.php">
<table class="form">
<tr>
<th><label for="input-one"><strong>First Name:</strong></label></th>
<td><input name="NameInput" id="NameInput" type="text" size="30" class="text-input" maxlength="30" value=" <?php print "$FirstNameField"; ?>" /></td>
</tr>

<tr>
<th><label for="input-two"><strong>Surname:</strong></label></th>
<td><input name="SurnameInput" id="SurnameInput" type="text" size="30" maxlength="30" class="text-input" value="<?php print "$SurnameField"; ?>" /></td>
</tr>

<tr>
<th><label for="input-three"><strong>Email Address:</strong></label></th>
<td><input name="EmailInput" id="EmailInput" type="text" size="50" maxlength="50" class="text-input" value="<?php print "$EmailField"; ?>" /></td>
</tr>

<tr>
<th class="message-up"><label for="message"><strong>Message:</strong></label></th>
<td>
<textarea name="MessageInput" id="MessageInput" cols="30" rows="5" ><?php print "$MessageField"; ?></textarea>
</td>
</tr>

<tr>
<th class="input-three"><label for="question"><strong>Question:</strong></label></th>
<td><samp>99&nbsp;+&nbsp;11&nbsp;=</samp> &nbsp; <input name="spam-protection" id="question" type="text" size="5" class="antispam" />
<span><strong>(spam protection)</strong></span></td>
</tr>


<tr>
<td class="submit-button-right" colspan="2">
<input class="submit-text" type="submit" value="Send" />
<input type="hidden" name="ParseVar" id="ParseVar" value="Contactform" />
<input name="Reset" type="reset" class="submit-text" id="Reset" value="Reset" /></td>
</tr>
<tr>
<th colspan="2"> <?php print "$Sent"; ?></th>
</tr>
</table>
<p>&nbsp;</p>
</form>






The PHP code is:



<?php
if <$_POST['ParseVar'] == "Contactform"> {

$EmailTitle = 'New email From Teaguephotography.co.uk';
$YourEmail = 'mteaguephotography@gmail.com';

$EmailField = $_POST ['EmailInput'];
$FirstNameField = $_POST ['NameInput'];
$SurnameField = $_POST ['SurnameInput'];
$MessageField = $_POST ['MessageInput'];

$body = <<<EOD
<br><hr><br>
Firstname: $FirstNameField <br />
Surname: $SurnameField <br />
Email: $EmailField <br />
Message: $MessageField <br />
EOD;

$headers = "From:$EmailField\r\n";
$headers .= "Content-Type: text/html\r\n";
$success = mail <"$YourEmail", "$EmailTitle", "$body", "$headers">;

$Sent = "Thank You! Your message has been sent.";


}
?>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ContactForm.PHP</title>
</head>

<body>

</body>
</html>






If anyone could please help me it would be greatly appricated, Im only starting at PHP and i am a bit of a newbie.

Thanks Mat




The pokemon kid
United Kingdom
Posts:1
Joined:Oct 17, 2011
  
Home About Contact Forum Youtube Privacy Policy
Copyright © 2009-2011 RiverCityGraphix.All Rights Reserved.