Hi there,
The most frustrating part is that I've gotten this coding right before, but I can't for the life of me remember how.
I have a very simple HMTL booking form, using method=POST to access booking.php so that the info can be sent to me as an email. I've looked all over the internet and found someone who suggested the php code I'm now using but I keep getting the same error. I now want to make the Booking Form itself more complex but if I can't get the simple php code down then I can't do much.
Here is the HTML form:
<form name="bookingform" action="booking.php" method="post">
<table style="text-align: left; width: 100%;" border="0"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td class="bookform_first">
<p>Your Name:</p>
</td>
<td class="bookform_second"><input class="form" name="name"></td>
</tr>
<tr>
<td class="bookform_first">
<p>Email Adress:</p>
</td>
<td class="bookform_second"><input class="form" name="email"></td>
</tr>
<tr>
<td class="bookform_first">
<p>Contact Number:</p>
</td>
<td class="bookform_second"><input class="form" name="number"></td>
</tr>
<tr>
<td class="bookform_first">
<p>Gender</p>
</td>
<td class="bookform_second"><input name="gender" class="form"></td>
</tr>
<tr>
<td class="bookform_first">
<p>Type of session:</p>
</td>
<td class="bookform_second"><input class="form" name="session"></td>
</tr>
<tr>
<td class="bookform_first">
<p>Date and Time</p>
</td>
<td class="bookform_second"><input class="form" name="datetime"></td>
</tr>
<tr>
<td class="bookform_first">
<p>Comments:</p>
</td>
<td class="bookform_second"><textarea id="textareaforms"
rows="10" cols="50" name="comments"></textarea></td>
</tr>
</tbody>
</table>
<input value="Submit" type="submit"> <input value="Reset"
type="Reset"></form>
I've put the form into a table because the alignment was just nicer and easier on the eye.
Here is the PHP doc I'm using:
<?php
$email_to = "[email protected]";
$email_subject = "Booking Request";
$name = cleanString($_POST['name']);
$email = cleanString($_POST['email']);
$number = cleanString($_POST['number']);
$gender = cleanString($_POST['gender']);
$session = cleanString($_POST['session']);
$datetime = cleanString($_POST['datetime']);
$comments = cleanString($_POST['comments']);
$message= "
Online Form - $email_subject
_________________________________________________________
Name: $name
Email: $email
Phone: $number
Gender: $gender
Session: $session
Time: $datetime
_________________________________________________________
$comments
_________________________________________________________
";
$extraheaders = "From: $email\nReply-To: $email\n\n";
if (! mail($email_to, $email_subject, $message, $extraheaders))
echo "Mail did not send for some reason.";
echo "Thank you for your booking. You will receive a confirmation email shortly.";
echo "If you do not receive confirmation within 24 hours, please email contact us";
?>
The error is the following:
Fatal error: Call to undefined function cleanstring() in /home/thurisaz/public_html/booking.php on line 7
PLEASE HELP!!
Thank you so much!
The most frustrating part is that I've gotten this coding right before, but I can't for the life of me remember how.
I have a very simple HMTL booking form, using method=POST to access booking.php so that the info can be sent to me as an email. I've looked all over the internet and found someone who suggested the php code I'm now using but I keep getting the same error. I now want to make the Booking Form itself more complex but if I can't get the simple php code down then I can't do much.
Here is the HTML form:
<form name="bookingform" action="booking.php" method="post">
<table style="text-align: left; width: 100%;" border="0"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td class="bookform_first">
<p>Your Name:</p>
</td>
<td class="bookform_second"><input class="form" name="name"></td>
</tr>
<tr>
<td class="bookform_first">
<p>Email Adress:</p>
</td>
<td class="bookform_second"><input class="form" name="email"></td>
</tr>
<tr>
<td class="bookform_first">
<p>Contact Number:</p>
</td>
<td class="bookform_second"><input class="form" name="number"></td>
</tr>
<tr>
<td class="bookform_first">
<p>Gender</p>
</td>
<td class="bookform_second"><input name="gender" class="form"></td>
</tr>
<tr>
<td class="bookform_first">
<p>Type of session:</p>
</td>
<td class="bookform_second"><input class="form" name="session"></td>
</tr>
<tr>
<td class="bookform_first">
<p>Date and Time</p>
</td>
<td class="bookform_second"><input class="form" name="datetime"></td>
</tr>
<tr>
<td class="bookform_first">
<p>Comments:</p>
</td>
<td class="bookform_second"><textarea id="textareaforms"
rows="10" cols="50" name="comments"></textarea></td>
</tr>
</tbody>
</table>
<input value="Submit" type="submit"> <input value="Reset"
type="Reset"></form>
I've put the form into a table because the alignment was just nicer and easier on the eye.
Here is the PHP doc I'm using:
<?php
$email_to = "[email protected]";
$email_subject = "Booking Request";
$name = cleanString($_POST['name']);
$email = cleanString($_POST['email']);
$number = cleanString($_POST['number']);
$gender = cleanString($_POST['gender']);
$session = cleanString($_POST['session']);
$datetime = cleanString($_POST['datetime']);
$comments = cleanString($_POST['comments']);
$message= "
Online Form - $email_subject
_________________________________________________________
Name: $name
Email: $email
Phone: $number
Gender: $gender
Session: $session
Time: $datetime
_________________________________________________________
$comments
_________________________________________________________
";
$extraheaders = "From: $email\nReply-To: $email\n\n";
if (! mail($email_to, $email_subject, $message, $extraheaders))
echo "Mail did not send for some reason.";
echo "Thank you for your booking. You will receive a confirmation email shortly.";
echo "If you do not receive confirmation within 24 hours, please email contact us";
?>
The error is the following:
Fatal error: Call to undefined function cleanstring() in /home/thurisaz/public_html/booking.php on line 7
PLEASE HELP!!
Thank you so much!