Reservation availability Script Using PHP and Dreamweaver CS3


I am looking to design or obtain a php script that would let users check my availabilty on a given day.

See URL : and look at the check dates form on the left column,
This is exactly what i'm looking for.

I can use dreamweaver cs3 to design dynamic sites but i am unsure how to design this type of form.
I have been looking at ready made scripts but they are too detailed and complicated.

Who is Participating?
v2MediaConnect With a Mentor Commented:
Unfortunately email forms require some protection against exploitation and this makes the script a little complex. Here's something to get you started. It provides protection against spam exploitation to other users, but you may still receive some spam from it. Read the php/html comments for usage instructions.
	the email address emails are from
	the email address emails are sent to
//$EMAIL_TO = '';
$EMAIL_TO = '';
$errors = '';
$_SESSION['formID'] = (!empty($_SESSION['formID'])) ? $_SESSION['formID'] : md5(date('Y/m/d h:i:s').'r4nd0m');
$formID = $_SESSION['formID'];
$mail_ok = false;
if(isset($_POST['submit'])) {
$name = (!empty($_POST['name']))? $_POST['name'] : NULL;
$user = (!empty($_POST['user']))? $_POST['user'] : NULL;
$domain = (!empty($_POST['domain']))? $_POST['domain'] : NULL;
$date = (!empty($_POST['date']))? $_POST['date'] : NULL;
$location = (!empty($_POST['location']))? $_POST['location'] : NULL;
$phone = (!empty($_POST['phone']))? $_POST['phone'] : 'Not Supplied';
$source = (!empty($_POST['source']))? $_POST['source'] : 'Not Supplied';
//check for null required fields;	
if($name == NULL || $user == NULL || $domain == NULL || $date == NULL || $location == NULL) {
	$errors .= 'All fields are required. Please fill in the empty field/s.';
//check formID
if($formID != $_POST['formID']) {
	$errors .= 'Form validation error. Please use this webpage only, not an external wepage.<br />';
//proceed if error free	
	if($errors == '') {
		$subject = 'Availability Enquiry';
		$headers = "From: $EMAIL_FROM\n";
		$message = 	"AVAILABILITY ENQUIRY"."\n\n".
					"Enquirer: ".$name."\n".
					"Phone: ".$phone."\n".
					"Email: ".$user.'@'.$domain."\n\n".
					"Job Location: ".$location."\n".
					"Job Date: ".$date."\n\n".
					"Form Submitted on ".date('d-m-Y h:i:s');
		$mail_ok = mail($EMAIL_TO, $subject, $message, $headers) ? true : false;
		if(!$mail_ok) {
			$errors .= 'The server encountered a problem sending your message. Please try again later or check your form values.<br />';
		} else {
			//generate new form ID
			$_SESSION['formID'] = md5(date('Y/m/d h:i:s').'r4nd0m');
			$formID = $_SESSION['formID'];
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Check Availability</title>
<script language="javascript" type="text/javascript">
function validate() {
	var retval = '';
	var arr_required = new Array();
	arr_required[0] = "user";
	arr_required[1] = "domain";
	arr_required[2] = "name";
	arr_required[3] = "location";
	arr_required[4] = "date";
	for( i=0;i<arr_required.length;i++) {
		if(document.getElementById(arr_required[i]).value == "") retval += arr_required[i] + " is required\n";
	if(retval == '') {
		return true;
	} else {
		return false;
<div id="frmChkAvail">
    <p><strong>Check your date?</strong> (* indicates required fields)</p>
<?php if($errors != '') echo "<p class=\"errors\">$errors</p>"; ?>
  <form action="?submit" method="post" name="enqform" id="enqform" onsubmit="return validate()">
        <span class="small">*Email Address: ('user' @ 'domain')</span><br />
        <input size="20" value="" name="user" id="user" /> @ <input type="text" name="domain" id="domain" /><br />
        <span class="small">*Your Name:</span><br />
    <input size="20" value="" name="name"  id="name"><br />
        <span class="small">Phone:</span><br />
    <input size="20" value="" name="phone" id="phone"><br />
        <span class="small">*When? (e.g. 1 April 2008)</span><br />
    <input size="20" value="" name="date" id="date"><br />
        <span class="small">*Location/s</span><br />
    <input value="" name="location" size="20" id="location"><br />
        <span class="small">How did you hear about us?</span><br />
    <select name="source">
                    <option>Please select one</option>
                    <option>Phone Directory</option>           
        <br /><br />
        <input id="submit" name="submit" value="Check Availability" type="submit">
        <input name="formID" type="hidden" id="formID" value="<?php echo $formID ?>" />
        <br />
//snippet that displays email successful message
if($mail_ok) {
//start success message
<!-- success message (html below will output on success) -->
<h3>Thanks for your enquiry</h3>
<p>Availability will be confirmed and you'll receive a response shortly.</p>
<!-- end success message -->
//snippet that displays email successful message
<p>Form ID: <?php echo $formID ?></p>
<p>Confirm: <?php echo $_SESSION['formID'] ?></p>

Open in new window

This would be a basic email form. After testing it, the result of submitting the form was either a) error or b) thx for your enquiry. So, all you need is a simple email script to mail you the form values in a logical message. Is this right or am I missing something?
kevinb4940Author Commented:
You are on right thanks. Would it be possible to get the php code that actually makes this form work please
kevinb4940Author Commented:
Thanks a lot. Ireally appreciate your time and help I will delete line 17 as requested
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.