Hi Everyone.
New to PHP. What im trying to make is a contact form.
I know all the functions im using work (or seem to work to me) as I'm using them elsewhere on the site as part of a mailing list script.
So what I want it to do is to take the users info, email the user confirming theyve sent there comments etc, and then email me the same info (not added the second email part yet)
I get this error. From what I have read I believe its to do with { and } missing somewhere from my if statements.
Parse error: syntax error, unexpected $end in /home/nllu2n/public_html/reefzoneaquatics/contactbuild.php on line 258
Here is my code. Its a bad layout I know.
Any help would be appreciated.
Michael
<?php include "header.php";
//image header
$image = "http://www.reefzoneaquatics.co.uk/images/emailheader.jpg";
//form submitted
if(isset($_POST["submit"])){
//recaptcha image verification
require_once('recaptchalib.php');
$privatekey = "6LeccgsAAAAAADir59E0oo3gYW4JJLpowzF00XXN";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
?>
<h5>
<br>
The image verification wasn't entered correctly. Go back and try it again.
<br>
<br>
<a href="javascript: history.go(-1)">< < Go Back</a>
</h5>
</div>
<?php
//include footer if there is an error
include "./footer.php";
die("");
}else
//set variable names
$name = $_POST["fname"];
$lname = $_POST["lname"];
$email = $_POST["email"];
$comments = $_POST["comments"];
//subscribe
if($_POST["action"]=="subscribe"){
//check if name is long enough
if(strlen($name)<3){
?>
<h5>
<br>
First name must consist of at least 3 characters.
<br>
<br>
<a href="javascript: history.go(-1)">< < Go Back</a>
</h5>
<?php
//check if name is long enough
}else if(strlen($lname)<3){
?>
<h5>
<br>
Last name must consist of at least 3 characters.
<br>
<br>
<a href="javascript: history.go(-1)">< < Go Back</a>
</h5>
<?php
//check if email is valid
}else if(!eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",$email)){
?>
<h5>
<br>
Email address is not valid.
<br>
<br>
<a href="javascript: history.go(-1)">< < Go Back</a>
</h5>
<?php
//send confirmation email
$to = $_POST["email"];
$subject = "Reef Zone Aquatics Contact Form";
$message = "
<html>
<body>
<div align='center'><img src='http://www.reefzoneaquatics.co.uk/images/emailheader.jpg'>
<br>
<br>
<font size='6' font face='Calibri'>
<strong>
Contact Us
</strong>
</font>
<br>
<br>
<font size='3' font face='Calibri'>
<h5>Contact Us form submission</h5>
<br>
<br>
Hi $name $lname, thankyou for contacting Reef Zone Aquatics.
<br>
<br>
We endevour to reply to you on the following email address ( $email ) in 3 working days.
<br>
<br>
Yours, Reef Zone Aquatics
<br>
<br>
----------------------------------------------------------------------------------------------------
<br>
<font size='2' font face='Calibri'>
You receive this email because you have contact Reef Zone Aquatics.
<font size='1' font face='Calibri'>
* * * This email was sent from an automated system * * *
</font>
<br>
</font>
</div>
</body>
</html>
";
// Set content-type
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
// More headers
$headers .= 'From: <support@reefzoneaquatics.co.uk>' . "\r\n";
// Send mail line
mail($to,$subject,$message,$headers);
//error occurred
if(@mysql_error()){
?>
<h5>
<br>
An unknown error occurred. Please try again later.
<br>
<br>
<a href="javascript: history.go(-1)">< < Go Back</a>
</h5>
<?php
//successful
}else{
?>
<h5>
<br>
Congratulations! Your comments have been sent to an administrator!
<br>
<a href="javascript: history.go(-1)">< < Go Back</a>
</h5>
<h1>
Contact Us
</h1>
<hr>
<br>
<p>Please fill in the form below</p>
<h3>Contact Form</h3>
<table width="579">
<tr>
<td width="124" valign="top">First Name:<br> <br> </td>
<td width="270"><input name="fname" type="text" value="" size="48" maxlength="255">
<br> <br> </td>
</tr>
<tr>
<td width="124" valign="top">Last Name:<br> <br> </td>
<td width="270"><input name="lname" type="text" value="" size="48" maxlength="255">
<br> <br> </td>
</tr>
<tr>
<td height="63" valign="top">Your email address:</td>
<td><p>
<input name="email" type="text" value="" size="48" maxlength="255">
<br>
<br>
<br>
</p>
</td>
</tr>
<tr>
<td valign="top">Your Comments:</td>
<td><textarea name="comments" cols="37" rows="6"></textarea>
<br>
<br>
</td>
</tr>
<tr>
<td valign="top">Verification:</td>
<td>
<?php
// Display Recaptcha
require_once('./mailer/recaptchalib.php');
$publickey = "6LeccgsAAAAAALtX6OhBgjT875dqwxsPgE1NU9Sm";
echo recaptcha_get_html($publickey);
?>
</td>
</tr>
<tr>
<td valign="top"> </td>
<td><br> <input type="radio" name="action" value="subscribe" id="action_subscribe" checked>
<label for="action_subscribe">subscribe</label>
<input type="radio" name="action" value="unsubscribe" id="action_unsubscribe">
<label for="action_unsubscribe">unsubscribe<br>
</label></td>
</tr>
<tr>
<td valign="top"> </td>
<td><p> <br>
<input type="submit" name="submit" value="Submit">
<input type="reset" name="submit2" value="Reset">
</p></td>
</tr>
</table>
<p> </p>
<p> </p>
<p><br></div>
</p>
<?php
// Display Footer
include "footer.php";
?>