Hi too all.
Thanks very much for reading my post.
I am having an issue with a form. I have got it working to the point where it validates all the areas I need but when I place the mail feature in I start getting parse errors.
I have no errors until I enter the mail () code.
I am new to php and usually outsource my forms, unfortunately my client does not have the budget for it.
Could someone please tell me where I have gone wrong.
Please see code below.
FORM: (the funny :< you see should be < )
<h1>Thank you for your input!</h1>
<h2>Please feel free to send your comments and questions</h2>
<form action=“handle_contact_form.php” method=“post”>
<fieldset><legend>Your contact details</legend>
<label for=“name”>Name:</label><input type=“text” name=“name” size=“30”
maxlength=“60” />
<div class=“tel”>
<label for=“tel”>Tel:</label><input type=“text” name=“tel” size=“30”
maxlength=“60” />
</div>
<label for=“email”>Email:</label><input type=“text” name=“email” size=“30”
maxlength=“60” />
<div class=“fax”>
<label for=“fax”>Fax:</label><input type=“text” name=“fax” size=“30”
maxlength=“60” />
</div>
</fieldset>
<fieldset><legend>Comments</legend>
<label></label> <textarea name=“comments” rows=“4” cols=“62”></textarea><br>
<input checked type=“checkbox” name=“suscribe” value=“Suscribe” /><label for=“suscribe” class=“suscribe”>Subscribe to our email newsletter</label>
</fieldset>
<div class=“submit” align=“center”><input type=“submit” name=“submit” value=“Submit” />
</div>
</form>
PHP FORM HANDLER:
<?php #handle_contact_form.php
//validate name
if (!empty($_REQUEST[‘name’])) {
$name = stripslashes($_REQUEST[‘name’]);
}
else {
$name = NULL;
echo ‘<p><font color=“red”>You forgot to enter your Name</font></p>’;
}
//Validate Tel
if (!empty($_REQUEST[‘tel’])){
$tel = stripslashes($_REQUEST[‘tel’]);
}
else {
$tel = NULL;
echo ‘<p><font color=“red”>You forgot to enter your Telephone Number</font></p>’;
}
//Validate email
if (!empty($_REQUEST[‘email’])) {
$email = $_REQUEST[‘email’];
}
else {
$email = NULL;
echo ‘<p><font color=“red”>You forgot to enter your Email Address</font></p>’;
}
//Validate comments
if (!empty($_REQUEST[‘comments’])){
$tel = stripslashes($_REQUEST[‘comments’]);
}
else {
$comments = NULL;
echo ‘<p><font color=“red”>You forgot to enter your Telephone Number</font></p>’;
}
// Validate suscribe
if (!empty($_REQUEST[‘suscribe’])){
$suscribe = stripslashes($_REQUEST[‘suscribe’]);
}
else {
$suscribe = “not suscribe you to our news letter”;
}
// If everything is okay send email and display
if ($name && $email && $comments && $tel) {
$body = " African Agenda has been contacted by ‘{$_POST[‘name’]}’,
from email address ‘{$_POST[‘email’]}’.
<br>
‘{$_POST[‘name’]}’
made the comments<br>
‘{$_POST[‘comments’]}’ \
<br>
You have been requested to '{$_POST['suscribe']}'. \
" ;
mail ('admin@reesdynamic.co.za' , 'contact email' , $body );
echo "<p>Thank you, <b>$name</b>, \
for the following comments: <br />
<tt>$comments</tt></p> ";
echo "<p>We will reply to you at <i>$email</i>.</p>you have asked us to <i>$suscribe</i>
" ;
}
else {
echo “Please go back to fill out the form again” ;
}
?>
Any help or advice would greatly be appreciated.
Thanks very much for your time and help
Mike