--- /dev/null
+<!-- <b>Please click on the room type below to view a floor plan:</b><BR>\r
+<a href="3bedroom.html" target="_blank" onClick = "window.open ('<?echo BASE_URL;?>3bedroom.html', 'html','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=350,height=430'); return( false );">\r
+3 bedroom & loft, 2 bathroom (sleeps 8-10)</a><BR>\r
+<a href="2bedroom.html" onClick = "window.open ('<?echo BASE_URL;?>2bedroom.html', 'html','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=350,height=390'); return( false );">\r
+2 bedroom & loft, 2 bathroom (sleeps 6-8)</a><BR>\r
+<a href="2bedroomplus.html" onClick = "window.open ('<?echo BASE_URL;?>2bedroomplus.html', 'html','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=350,height=380'); return( false );">\r
+2 bedroom, 2 bathroom + (sleeps 4-6)</a><BR>\r
+<a href="2bed2bath.html" onClick = "window.open ('<?echo BASE_URL;?>2bed2bath.html', 'html','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=225,height=500'); return( false );">\r
+2 bedroom, 2 bathroom (sleeps 4-6)</a> <BR>\r
+<a href="2bed1bath.html" onClick = "window.open ('<?echo BASE_URL;?>2bed1bath.html', 'html','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=225,height=450'); return( false );">\r
+2 bedroom, 1 bathroom (sleeps 4-6)</a> <BR>\r
+<a href="1bed1bath.html" onClick = "window.open ('<?echo BASE_URL;?>1bed1bath.html', 'html','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=275,height=430'); return( false );">\r
+1 bedroom, 1 bathroom (sleeps 2-4)</a> <BR>\r
+<BR> -->\r
--- /dev/null
+<?php
+//include_once("classes/class_db.inc");
+$int_qs = "select * from contact_inq order by pos;";
+
+if( $data = $this->DB->db_auto_get_data($int_qs) )
+{
+ foreach( $data as $row )
+ {
+ $interest2[$row['id']] = $row['header'];
+ }
+}
+unset($unit_size);
+unset($referred_by);
+unset($fields);
+$THANKYOU_TEXT = "<br><br><br>
+ <h2>Thank you for the reservation request!</h2>
+";
+$GLOBALS["THANKYOU_TEXT"] = $THANKYOU_TEXT;
+$fields['fname'] = "First Name";
+$fields['lname'] = "Last Name";
+$fields['email'] = "Email Address";
+$fields['address'] = "Address ";
+$fields['city'] = "City ";
+$fields['state'] = "State ";
+$fields['zip'] = "Zip ";
+$fields['arrive_date'] = "Arrival Date";
+$fields['depart_date'] = "Departure Date";
+$fields['unit_size'] = "Unit Size ";
+$fields['referred_by'] = "Referred By";
+$fields['other'] = "Other ";
+$fields['question'] = "Questions";
+$unit_size2[6] = "5 bedroom & loft, 3.5 bathroom (sleeps 12)";
+$unit_size2[0] = "3 bedroom & loft, 2 bathroom (sleeps 8-10)";
+$unit_size2[1] = "2 bedroom & loft, 2 bathroom (sleeps 6-8)";
+$unit_size2[2] = "2 bedroom, 2 bathroom + (sleeps 4-6)";
+$unit_size2[3] = "2 bedroom, 2 bathroom (sleeps 4-6)";
+$unit_size2[4] = "2 bedroom, 1 bathroom (sleeps 4-6)";
+$unit_size2[5] = "1 bedroom, 1 bathroom (sleeps 2-4)";
+$referred_by2[0] = "AAA";
+$referred_by2[1] = "Big Fore";
+$referred_by2[2] = "Chamber/Visitors Bureau";
+$referred_by2[3] = "Detroit Free Press";
+$referred_by2[4] = "Friends/Relatives";
+$referred_by2[5] = "Great Rentals Web Site";
+$referred_by2[6] = "Internet";
+$referred_by2[7] = "Nubs Nob";
+$referred_by2[8] = "Other";
+$referred_by2[9] = "Past Guest";
+/*
+$interest2[0] = "Golf Trip";
+$interest2[1] = "Big 4 Golf Package";
+$interest2[2] = "Ski Trip";
+$interest2[3] = "Family vacation";
+$interest2[4] = "Family Reunion";
+$interest2[5] = "Romantic Getaway";
+$interest2[6] = "Honeymoon/Anniversary";
+$interest2[7] = "Soccer Weekend";
+$interest2[8] = "Wedding Group";
+$interest2[9] = "Biking";
+$interest2[10] = "Fishing";
+$interest2[11] = "Tennis";
+$interest2[12] = "Business";
+$interest2[13] = "Fall Color Tour";
+$interest2[14] = "Morel Mushrooms";
+$interest2[15] = "Spring/Fall Relaxing vacation";
+$interest2[16] = "Empty Nester Getaway";
+$interest2[17] = "Real Estate";
+$interest2[18] = "Senior Packages";
+$interest2[19] = "Scrapbooking";
+*/
+$GLOBALS['fields'] = $fields;
+$GLOBALS['unit_size2'] = $unit_size2;
+$GLOBALS['referred_by2'] = $referred_by2;
+$GLOBALS['interest2'] = $interest2;
+function build_select($array,$name,$multiple = 0)
+{
+ if(is_array($array))
+ {
+ $select = '<select name="'.$name.'"';
+ if($multiple == 1)
+ {
+ $select .= ' multiple size="10"';
+ }
+ $select .= '>';
+ $select .= '<option value="">Please select</option>';
+ foreach($array as $key=>$value)
+ {
+ $select .= '<option value="'.$key.'">'.$value.'</option>';
+ }
+ $select .= '</select>';
+ }
+ return($select);
+}
+function build_checkbox($int_array)
+{
+ $total = count($int_array);
+ if($total == 0)
+ return(false);
+ $split = $total / 2;
+ $padding = $split * 2;
+ $int_array = array_pad($int_array,$padding," ");
+ $interest .= "<table border=0><tr>";
+ $count = 1;
+ foreach($int_array as $key=>$value)
+ {
+ $interest .= "<td>";
+ $interest .= "<input type=\"checkbox\" name=\"interest[$count]\" value=\"$key\"";
+ $interest .= "><font size=\"2\" face=\"arial, helvetica\">$value</font><br>";
+ $interest .= "</td>";
+ if($count%2==0 && $count != $padding)
+ {
+ $interest .= "</tr><tr>";
+ }
+ elseif($count == $padding)
+ {
+ $interest .= "</tr>";
+ }
+ $count++;
+ }
+ $interest .= "</tr></TABLE>";
+ return($interest);
+}
+function process_form( $_POST )
+{
+ extract($_POST);
+ foreach($_POST as $key=>$value)
+ {
+ if($key == "email" && ( !GLM_TEMPLATE::valid_email($value) || $value == "" ))
+ {
+ $errors["email"] = "<div style=\"color:red;\">your email is not valid or empty!</div>";
+ }
+ if($key == "fname" && $value == "" )
+ {
+ $errors["fname"] = "<div style=\"color:red;\">your name is empty!</div>";
+ }
+ if($key == "referred_by" && $value == "")
+ {
+ $errors["referred_by"] = "<div style=\"color:red;\">Required Field!</div>";
+ }
+ if($key == "other" && $value != "")
+ {
+ unset($errors["referred_by"]);
+ }
+ }
+ if(is_array($errors) && count($errors) > 0)
+ {
+ return($errors);
+ }
+ else
+ {
+ $DB =& new GLM_DB();
+ $DB->db_connect();
+ // database part
+ if(is_array($interest))
+ {
+ foreach($interest as $ik=>$iv)
+ {
+ $int4[] = $GLOBALS['interest2'][$iv];
+ }
+ $interest = ':'.implode(":",$int4).':';
+ }
+ unset($_POST["interest"]);
+ // catid must be unset so it doesn't try to stick it in the db
+ unset($_POST['catid']);
+ $_POST["interest"] = $interest;
+ foreach($_POST as $key=>$value){
+ if($key == "SUBMIT")
+ continue;
+ if($key == "arrive_date" && $value == "")
+ continue;
+ if($key == "depart_date" && $value == "")
+ continue;
+ if($key == "referred_by" && $value == "")
+ {
+ $tmp[] = $key;
+ $tmp_val[] = "NULL";
+ continue;
+ }
+ if($key == "unit_size" && $value == "")
+ {
+ $tmp[] = $key;
+ $tmp_val[] = "NULL";
+ continue;
+ }
+ $tmp[] = $key;
+ $tmp_val[] = "'$value'";
+ }
+ $tmp = implode($tmp,",");
+ $tmp_val = implode($tmp_val,",");
+ $date = date("m/d/Y");
+ $query = "INSERT INTO contact (create_date,$tmp) VALUES ('$date',$tmp_val)";
+ $DB->db_exec($query);
+ $DB->db_close();
+ //echo $query;
+ // mail part
+ foreach($_POST as $key=>$value)
+ {
+ if($key == "SUBMIT")
+ {
+ continue;
+ }
+ if($key == "interest")
+ {
+ $interest = $GLOBALS['interest2'][$value];
+ $body .= $GLOBALS['fields'][$key]."\t$interest\n";
+ }
+ if($key == "referred_by")
+ {
+ $referred = $GLOBALS['referred_by2'][$value];
+ $body .= $GLOBALS['fields'][$key]."\t$referred\n";
+ }
+ elseif($key == "unit_size")
+ {
+ $unit = $GLOBALS['unit_size2'][$value];
+ $body .= $GLOBALS['fields'][$key]."\t$unit\n";
+ }
+ elseif($key == "mail_ok")
+ {
+ if($value == 't')
+ $body .= "Yes I would like email\n";
+ }
+ elseif($value != "")
+ {
+ $body .= $GLOBALS['fields'][$key]."\t$value\n";
+ }
+ }
+ $subject = "You have received a reservation request!";
+ $headers = "Reply-To: ".REPLY_TO."\n";
+ mail(OWNER_EMAIL,$subject,$body,$headers);
+ echo $GLOBALS["THANKYOU_TEXT"];
+ return(true);
+ }
+
+}
+function show_form( $errors = NULL )
+{
+ $unit = build_select($GLOBALS['unit_size2'],"unit_size");
+ $referred = build_select($GLOBALS['referred_by2'],"referred_by");
+ $intr = build_checkbox($GLOBALS['interest2']);
+
+ echo '
+ <!-- form table begin -->
+ <p>*=Required Form Fields</p>
+ <FORM METHOD="POST" ACTION="'.$_SERVER["PHP_SELF"].'?catid='.$_GET['catid'].'">
+ <table cellpadding=3 cellspacing="3" border="0" width="100%" align="left">
+ <tr>
+ <td align=right width="175"><font size="2" face="arial, helvetica">* First
+ Name:</font></td>
+ <td>
+ <input type="hidden" name="catid" value="'.$_GET['catid'].'">
+ <input type="TEXT" name="fname" size=25>
+ '.$errors["fname"].'
+ </td>
+ </tr>
+ <tr>
+ <td align=right width="175"><font size="2" face="arial, helvetica">Last
+ Name: </font></td>
+ <td>
+ <input type="TEXT" name="lname" size=25>
+ '.$errors["lname"].'
+ </td>
+ </tr>
+ <tr>
+ <td align=right width="175"><font size="2" face="arial, helvetica">* Email
+ Address: </font></td>
+ <td>
+ <input type="TEXT" name="email" size=25>
+ '.$errors["email"].'
+ </td>
+ </tr>
+ <tr>
+ <td align=right width="175"><font size="2" face="arial, helvetica">Address:
+ </font></td>
+ <td>
+ <input type="TEXT" name="address" size=25>
+ '.$errors["address"].'
+ </td>
+ </tr>
+ <tr>
+ <td align=right width="175"><font size="2" face="arial, helvetica">City:
+ </font></td>
+ <td>
+ <input type="TEXT" name="city" size=25>
+ '.$errors["city"].'
+ </td>
+ </tr>
+ <tr>
+ <td align=right width="175"><font size="2" face="arial, helvetica">State:
+ </font></td>
+ <td>
+ <input type="TEXT" name="state" size=25>
+ '.$errors["state"].'
+ </td>
+ </tr>
+ <tr>
+ <td align=right width="175"><font size="2" face="arial, helvetica">Zip:
+ </font></td>
+ <td>
+ <input type="TEXT" name="zip" size=25>
+ '.$errors["zip"].'
+ </td>
+ </tr>
+ <tr>
+ <td align=right width="175"><font size="2"
+ face="arial, helvetica">Phone:
+ </font></td>
+ <td>
+ <input type="TEXT" name="phone" size=25>
+ '.$errors["city"].'
+ </td>
+ </tr>
+ <tr>
+ <td align=right width="175"><font size="2" face="arial, helvetica">Date
+ Requested From: </font></td>
+ <td>
+ <input type="TEXT" name="arrive_date" size=15>
+ '.$errors["arrive_date"].'
+ <font face="Arial, Helvetica, sans-serif" size="1">(dd/mm/yy)</font></td>
+ </tr>
+ <tr>
+ <td align=right width="175"><font size="2" face="arial, helvetica">Date
+ Requested To: </font></td>
+ <td>
+ <input type="TEXT" name="depart_date" size=15>
+ '.$errors["depart_date"].'
+ <font face="Arial, Helvetica, sans-serif" size="1">(dd/mm/yy)</font></td>
+ </tr>
+ <tr>
+ <td align=right width="175"><font size="2" face="arial, helvetica">Unit
+ Size: </font></td>
+ <td>'.$unit.'
+ '.$errors["unit_size"].'
+ </td>
+ </tr>
+ <tr>
+ <td align=right width="175"><font size="2" face="arial, helvetica">
+ * How did you hear about<br> Trout Creek?</font> </td>
+ <td>'.$referred.'
+ '.$errors["referred_by"].'
+ </td>
+ </tr>
+ <tr>
+ <td align=right width="175"><font face="Arial, Helvetica, sans-serif" size="2">
+ <B>If other, please specify:</B></font></td>
+ <td>
+ <textarea name="other" cols="25"></textarea>
+ '.$errors["other"].'
+ </td>
+ </tr>
+ <tr>
+ <td align=right width="175"><font size="2" face="arial, helvetica">
+ Let us know what you are interested in: </font> </td>
+ <td>'.$intr.'
+ '.$errors["interest"].'
+ </td>
+ </tr>
+ <tr>
+ <td align=right width="175"><font size="2" face="arial, helvetica">
+ Additional Questions: </font></td>
+ <td>
+ <textarea name="questions" rows="3" cols="25"></textarea>
+ '.$errors["questions"].'
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" align="left" width="175"><font size="2" face="arial, helvetica">
+ Please notify me of specials and offers.
+ </font>
+ <input type="radio" name="mail_ok" value="t" checked><font size="2" face="arial, helvetica">Yes</font>
+ <input type="radio" name="mail_ok" value="f"><font size="2" face="arial, helvetica">No</font>
+ </td>
+ </tr>
+ <tr>
+ <td><br>
+ </td>
+ <td align=left>
+ <input type="SUBMIT" value="Place Request" name="SUBMIT">
+ </td>
+ </tr>
+ <tr>
+ <td colspan=2 align=left><font size="2" face="arial, helvetica">
+ Note: This is a reservation request only. It does not guarantee
+ a reservation. </font></td>
+ </tr>
+ </table>
+ </form>
+ <!-- form table end -->';
+}
+
+if(!$_POST){
+ show_form();
+}
+else{
+ if(is_array($errors = process_form($_POST))){
+ show_form($errors);
+ }
+}
+
+
+?>