ownd@optonline.net Posted March 12, 2012 Share Posted March 12, 2012 ok below is my form for making an appointment.. the part thats written in red below is where im having issues i need help with. probably simple stuff for someone who knows their php better than me. thank you very much in advance for any reccomendations. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Book an appointment @ K9CLUBHOUSE DOG HOTEL</title> <style type="text/css"> <!-- body { background-color: #000000; } body,td,th { color: #999999; } .style1 {color: #000000} .style2 {font-size: smaller} .style4 {font-size: smaller; font-weight: bold; } .style6 {color: #000000; font-weight: bold; } .style7 { color: #FF0000; font-style: italic; font-weight: bold; } .style9 { color: #FF0000 } .style10 { color: #999900; font-weight: bold; } .style11 {font-size: larger} .style12 {color: #CCCC00} --> </style></head> <body> <form action="book.php" method="POST" id="insert"> <div align="center"> <p><span class="style1">nnnnnnnnnnnnnnnnn</span><img src="booking.jpg" width="554" height="233" border="0" /><span class="style1">xxxxxxxxxxxxxxxx</span></p> <p> <label><strong>First Name</strong> <input type="text" name="firstname" id="firstname" /> <span class="style1"> xxx</span> <strong>Last Name</strong></label> <label> </label> <input type="text" name="lastname" id="lastname" /> </p> <p> <label><strong>Address</strong></label> <input name="address" type="text" id="address" size="50" /> </p> <p> <label><strong>City</strong></label> <input type="text" name="city" id="city" /> <span class="style1">xxx</span><strong>State</strong> <input name="state" type="text" id="state" size="5" maxlength="2" /> <span class="style1">xxx</span><strong>Zip Code</strong> <input name="zip" type="text" id="zip" size="15" maxlength="5" /> </p> <p> <label><strong>Home Phone</strong> <input type="text" name="homephone" id="homephone" /> </label> <span class="style1">xxx</span> <label><strong>Cell Phone</strong> <input type="text" name="cellphone" id="cellphone" /> </label> <br /> <span class="style1">-----------.---</span><span class="style4">(example 555-555-5555)</span><span class="style1">---------------------</span><span class="style4">(example 555-555-5555)</span></p> <p> <label></label> <label><strong>Email Address</strong> <input name="email" type="text" id="email" size="50" /> </label> </p> <p> <label><strong>Dog's Name</strong> <input name="dogname" type="text" id="dogname" size="30" /> </label> <label> <input type="checkbox" name="male" id="male" /> Male</label> <label> <input type="checkbox" name="female" id="female" /> Female</label> </p> <p> <label><strong>Dog's Breed</strong> <input name="dogbreed" type="text" id="dogbreed" size="37" /> </label> </p> <p> <label><strong>Drop Off Date</strong> <input name="dropdate" type="text" id="dropdate" maxlength="10" /> </label> <label><strong>Pickup Date</strong> <input name="pickupdate" type="text" id="pickupdate" maxlength="10" /> </label> <br /> <span class="style2"><span class="style1">----------------------------------------------------------------...--</span><strong>(example 03/15/2012)</strong></span><span class="style1">---------------------</span><span class="style4">(example 03/15/2012)</span><span class="style6">-</span><span class="style1">-.--------------------------</span></p> <p><span class="style1">- -</span>Is your dog <span class="style7">People Aggressive </span>? <label> <input type="checkbox" name="ppl_aggr_yes" id="ppl_aggr_yes" /> Yes</label> <label> <input type="checkbox" name="ppl_aggr_no" id="ppl_aggr_no" /> No</label> </p> <p><span class="style1">---</span>Is your dog <span class="style7">Other Dog Aggressive</span> ? <label> <input type="checkbox" name="dog_aggr_yes" id="dog_aggr_yes" /> Yes</label> <label> <input type="checkbox" name="dog_aggr_no" id="dog_aggr_no" /> No</label> </p> <p><span class="style1">---</span>Is your dog <span class="style7">Food Aggressive</span> ? <label> <input type="checkbox" name="food_aggr_yes" id="food_aggr_yes" /> Yes</label> <label> <input type="checkbox" name="food_aggr_no" id="food_aggr_no" /> No</label> </p> <p><span class="style1">- -</span>Is your dog <span class="style7">Spayed / Neutered</span> ? <label> <input type="checkbox" name="dog_fixed_yes" id="dog_fixed_yes" /> Yes</label> <label> <input type="checkbox" name="dog_fixed_no" id="dog_fixed_no" /> No</label> </p> <p> </p> <p class="style10"><span class="style11">**ATTENTION**</span><br /> After submitting this form by pressing the "Book My Appointment" button <br /> below, you will be required to pay a <span class="style9">$30.00 non refundable booking fee per pet, per appointment</span>. <br /> So please have your Visa/Mastercard/AMEX/Discover or Paypal information ready <br /> before proceeding. Thank you.</p> <p> </p> <p class="style9"><strong>BOARDING HOURS FOR DROP OFF OR PICK UP:</strong> </p> <p class="style9">MONDAY—FRIDAY…………. 9:00 a.m.— 8:00 p.m. <br /> SATURDAY…………………… 9:00 a.m.— 6:00 p.m. <br /> SUNDAY………………………10:00 a.m.— 5:00 p.m. <br /> HOLIDAYS …………………..10:00 a.m.— 2:00 p.m. </p> <p class="style9"><strong>DOGGIE DAYCARE HOURS :</strong> </p> <p class="style9">MONDAY—FRIDAY…………. 6:00 a.m.— 8:00 p.m. <br /> SATURDAY…………………… 9:00 a.m.— 6:00 p.m. <br /> SUNDAY………………………10:00 a.m.— 5:00 p.m.<br /> HOLIDAYS……………………...... Sorry, No Daycare</p> <p class="style9"><strong><u>2012 PRIME NIGHTS</u></strong> </p> <p class="style9">JANUARY 1 — JANUARY 2 <br /> FEBRUARY 17 — FEBRUARY 26 <br /> APRIL 6 — APRIL 14 <br /> MAY 25 — MAY 28 <br /> JULY 3 — JULY 8<br /> AUGUST 31 — SEPTEMBER 3<br /> NOVEMBER 21— NOVEMBER 25 <br /> DECEMBER 21— DECEMBER 31 </p> <p class="style9"><strong><u>2013 PRIME NIGHTS</u></strong> </p> <p class="style9">JANUARY 1</p> <p class="style9"><br /> <span class="style10"><span class="style9">**</span> Proof of vaccinations: Rabies, Parvo-Distemper (DHLPP), and Bordatella is mandatory at time of drop off.<span class="style9">**</span><br /> </span></p> <p class="style9"> <label><span class="style12">Special Instructions</span> <textarea name="instructions" id="instructions" cols="45" rows="5"></textarea> </label> </p> <p class="style9"> <label> <input type="submit" name="submitapp" id="submitapp" value="Book My Appointment" /> </label> </p> <p class="style9"> </p> </div> </body> </html> Now below is my action for the above form. <?php // contact to database $connect = mysql_connect("localhost", "boulder7_admin", "someone552083") or die ("Error , check your server connection."); mysql_select_db("boulder7_testdb"); this part is where I need help.. I need this following little statement underneath in red to do this: I need this little statement to first query the database and ask the database to SELECT and bring back all the rows that have a dropdate or pickup date between the dropoff date and pickup date the user has entered in the form, if the amount of rows brought back is less than 29 then it continues with the action below however if the amount of rows brought back is more than 29 it needs to simply print a message stating someone will contact them back as all rooms are booked. CAN SOMEONE PLEASE HELP ME IM GOING CRAZY TRYING TO GET THIS TO WORK AND IT HAS TO BE DONE TOMORROW MORNING!! ( mysql> SELECT * FROM contact WHERE -> dropdate BETWEEN $v_dropdate AND $v_pickupdate -> pickupdate BETWEEN $v_dropdate AND $v_pickupdate ____________________ //Get data in local variable $v_firstname=$_POST['firstname']; $v_lastname=$_POST['lastname']; $v_address=$_POST['address']; $v_city=$_POST['city']; $v_state=$_POST['state']; $v_zip=$_POST['zip']; $v_homephone=$_POST['homephone']; $v_cellphone=$_POST['cellphone']; $v_email=$_POST['email']; $v_dogname=$_POST['dogname']; $v_male=$_POST['male']; $v_female=$_POST['female']; $v_dogbreed=$_POST['dogbreed']; $v_dropdate=$_POST['dropdate']; $v_pickupdate=$_POST['pickupdate']; $v_ppl_aggr_yes=$_POST['ppl_aggr_yes']; $v_ppl_aggr_no=$_POST['ppl_aggr_no']; $v_dog_aggr_yes=$_POST['dog_aggr_yes']; $v_dog_aggr_no=$_POST['dog_aggr_no']; $v_food_aggr_yes=$_POST['food_aggr_yes']; $v_food_aggr_no=$_POST['food_aggr_no']; $v_dog_fixed_yes=$_POST['dog_fixed_yes']; $v_dog_fixed_no=$_POST['dog_fixed_no']; $v_instructions=$_POST['instructions']; // check for null values if ($v_firstname=="" or $v_lastname=="") echo "All fields must be entered, hit back button and re-enter information"; else{ $query="insert into contact(firstname,lastname,address,city,state,zip,homephone,cellphone,email,dogname,male,female,dogbreed,dropdate,pickupdate,ppl_aggr_yes,ppl_aggr_no,dog_aggr_yes,dog_aggr_no,food_aggr_yes,food_aggr_no,dog_fixed_yes,dog_fixed_no,instructions) values('$v_firstname','$v_lastname','$v_address','$v_city','$v_state','$v_zip','$v_homephone','$v_cellphone','$v_email','$v_dogname','$v_male','$v_female','$v_dogbreed','$v_dropdate','$v_pickupdate','$v_ppl_aggr_yes','$v_ppl_aggr_no','$v_dog_aggr_yes','$v_dog_aggr_no','$v_food_aggr_yes','$v_food_aggr_no','$v_dog_fixed_yes','$v_dog_fixed_no','$v_instructions')"; mysql_query($query) or die(mysql_error()); echo "Your appointment has been booked, Please confirm the booking by paying your $30 deposit by clicking here>>"; } ?> Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted March 12, 2012 Share Posted March 12, 2012 When posting code, enclose it within the forum's . . . BBCode tags. Quote Link to comment Share on other sites More sharing options...
fenway Posted March 12, 2012 Share Posted March 12, 2012 What's more, if this has to be done by "tomorrow morning", it sounds like a homework assignment. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.