2 Replies - 241 Views - Last Post: 03 October 2011 - 06:04 AM Rate Topic: -----

#1 wonderlhily  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 31
  • Joined: 19-August 11

Selected time in combo box not inserted to database

Posted 03 October 2011 - 02:40 AM

<?php include("C:/xampp/htdocs/mySalon/connect_database.php"); ?>

<?php
session_start();

if(isset ($_POST ['submit']) && ($_POST ['completeName']) && ($_POST ['mobileNumber']) && ($_POST ['emailAddress'])&& ($_POST ['date'])&& ($_POST ['time']) ){

$submit = $_POST['submit'];

//form data

$completeName = strip_tags ($_POST ['completeName']);
$mobileNumber = strip_tags ($_POST ['mobileNumber']);
$emailAddress = strip_tags ($_POST ['emailAddress']);
$date = $_POST ['date'];
$time = $_POST ['time'];



if ($submit)
{
		if (!empty($_POST['completeName']) && ($_POST['mobileNumber']) && ($_POST['emailAddress']) && ($_POST['date']) && ($_POST['time']) ) {
			$query="SELECT * FROM services_reserve WHERE completeName = '".$completeName."' 
			AND mobileNumber = '".$mobileNumber."' 
			AND emailAddress = '".$emailAddress."' 
			AND date_reserve = '".$date."'
			AND time_reserve = '".$time."'";
			$result = mysql_query($query);
			@$num_rows = mysql_num_rows($result);
			if ($num_rows == 0) {
				$query1="INSERT INTO services_reserve (completeName,mobileNumber,emailAddress,date_reserve,time_reserve)
			VALUES ('$_POST[completeName]','$_POST[mobileNumber]','$_POST[emailAddress]','$_POST[date]','$_POST[time]')";
		$result1 = mysql_query($query1);
				if(@result1 == 0) {?> 
				<script language="javascript">
				alert("Reservation detail has been send.Please check your email address for the confirmation.");
                </script> 
                <?
				}
				else { ?> <script language="javascript">
				alert("No record added.");
                </script><? }
		}
		else
			echo " not submitted";
	}
	else 
	echo "Please fill in <b>all</b> fields!";
}
}
?>



This post has been edited by wonderlhily: 03 October 2011 - 02:43 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Selected time in combo box not inserted to database

#2 wonderlhily  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 31
  • Joined: 19-August 11

Re: Selected time in combo box not inserted to database

Posted 03 October 2011 - 02:46 AM

here is my Form

   <form action="reservation.php" method="post">
                <table width="400" border="0" style="font-size:12px">
           
                  <tr>
                    <td><span class="style13">Complete Name:</span></td>
                    <td><input name="completeName" type="text" size="25"/></td>
                </tr>
             
                  <tr>
                    <td><span class="style13">Mobile Number:</span></td>
                    <td><input type="text" name="mobileNumber" size="25"/></td>
                  </tr>
                  <tr>
                  <td><span class="style13">Email Address:</span></td>
                <td><input type="text" name="emailAddress" size="25"/></td>
              </tr>
              </table>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                 <fieldset><legend class="style29">Preffered Date and Time</legend>
              <p>&nbsp;</p>
                <p align="center">
                  <input type="text" name="date" id="Date"/>
                  <a href="javascript:SelectDate()">
                  <img src="images/calendar_icon.gif"/></a>
                  <select name="time" id="time">
                 
                    <option value=""></option>
                    <option value="">8:00 am</option>
                    <option value="">8:30 am</option>
                    <option value="">9:00 am</option>
                    <option value="">9:30 am</option>
                    <option value="">10:00 am</option>
                    <option value="">10:30 am</option>
                    <option value="">11:00 am</option>
                    <option value="">11:30 am</option>
                    <option value="">12:00 pm</option>
                    <option value="">12:30 pm</option>
                    <option value="">1:00 pm</option>
                    <option value="">1:30 pm</option>
                    <option value="">2:00 pm</option>
                    <option value="">2:30 am</option>
                    <option value="">3:00 pm</option>
                    <option value="">3:30 pm</option>
                    <option value="">4:00 pm</option>
                    <option value="">4:30 pm</option>
                    <option value="">5:00 pm</option>
                    <option value="">5:30 pm</option>
                    <option value="">6:00 pm</option>
                    <option value="">6:30 pm</option>
                    <option value="">7:00 pm</option>
                    <option value="">7:30 pm</option>
                    <option value="">8:00 pm</option>
                    <option value="">8:30 pm</option>
                    <option value="">9:00 pm</option>
                  </select>
                  
                </p>
                <p>&nbsp;</p>
                </fieldset>
                  
              <p>&nbsp;</p>
              <input type="submit" name="submit" value="Reserve"/>
             
            </form>

Was This Post Helpful? 0
  • +
  • -

#3 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10186
  • View blog
  • Posts: 37,612
  • Joined: 27-December 08

Re: Selected time in combo box not inserted to database

Posted 03 October 2011 - 06:04 AM

Duplicate thread closed. Please avoid duplicate posting.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1