Help with code
Posted: Thu Jul 02, 2009 4:41 pm
Hi all,
I'm a massive newb with php and have built this site for a friend http://www.mileniumhair.co.uk and can not get the appointment page to work:http://www.milleniumhair.co.uk/booking.html
here is what I have cobbled together so far it's probably way OUT!!
can anyone help me ????? 
I'm a massive newb with php and have built this site for a friend http://www.mileniumhair.co.uk and can not get the appointment page to work:http://www.milleniumhair.co.uk/booking.html
here is what I have cobbled together so far it's probably way OUT!!
Code: Select all
<?php
/* Get the form variables */
$contact = "jonnyoreardon@yahoo.co.uk";
$subject = "Hair Appointment at Millennium";
$title = stripslashes ($HTTP_POST_VARS['title']);
$name = stripslashes ($HTTP_POST_VARS['name']);
$email = str_replace(' ','', stripslashes ($HTTP_POST_VARS['email']));
$day = stripslashes ($HTTP_POST_VARS['day']);
$time = stripslashes ($HTTP_POST_VARS['time']);
$referredby = stripslashes ($HTTP_POST_VARS['referred by']);
$errmsg="";
if( $HTTP_POST_VARS['action']=="request appointment")
{
if(!$HTTP_POST_VARS['name'])
{
$errmsg="<b>Please enter your name.</b>";
}
elseif(!$HTTP_POST_VARS['email'])
{
$errmsg="<b>Please enter your tel.</b>";
}
else if ($HTTP_POST_VARS['name'] )
{
/* Create the message to send */
$form_msg = "The following Form was submitted " .
"on milleniumhair.co.uk.\n\n";
$msg .= "title: " . stripslashes ($HTTP_POST_VARS['title']) . "\n";
$msg .= "Name: " . stripslashes ($HTTP_POST_VARS['name']) . "\n";
$msg .= "Email: " . stripslashes ($HTTP_POST_VARS['email']) . "\n";
$msg .= "Day: " . stripslashes ($HTTP_POST_VARS['day']) . "\n";
$msg .= "time: " . stripslashes ($HTTP_POST_VARS['time']) . "\n";
$msg .= "Enquiry: " . stripslashes ($HTTP_POST_VARS['enquiry']) . "\n";
/* Compose the message to send to the contact */
$form_msg .= $msg . "\nThank you for your request.\n";
/* Send it! */
mail($contact,$subject,$form_msg);
/* Send an email to the form poster confirming receipt of form */
$done=0;
if (eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,6}$", $email))
{ /* checks to see if email is valid */
$ret_subj = "Submission Confirmation";
$ret_msg .= "Thank you for submitting your appointment request.\n";
$ret_msg .= "The form details submitted were:\n\n";
$ret_msg .= $msg . "\nRegards,\webmaster@milleniumhair.co.uk";
mail ($email, $ret_subj, $ret_msg);
$done = 1;
}
else
{
$errmsg="<b>Please enter a valid email address.</b>";
}
}
}
?>