Hi all, by using form and post method in my program. It seems like my values of calendar are not able to insert into my database. I'm using jquery's datepicker and php to code. Please advice. Thanks

Recommended Answers

All 5 Replies

please post your code here [don't forget to use [code] ok?] and we'll see what's the problem

I solved the problem already. But i have another problem about the date format from the calendar.

$(function(){
$('#datepicker')
					.datepicker({
						inline: true,
						createButton:false,
						displayClose:true,
						closeOnSelect:false,
						selectMultiple:true,
						numSelectable:3
                                                
					})
					.bind(
						'dateSelected',
						function(e, selectedDate, $td, state)
						{
							console.log('You ' + (state ? '' : 'un') // wrap
								+ 'selected ' + selectedDate);
							
						}
					)
					.bind(
						'dpClosed',
						function(e, selectedDates)
						{
							console.log('You closed the date picker and the ' // wrap
								+ 'currently selected dates are:');
							console.log(selectedDates);
						}
					)
					;});

The date format is in MM-DD-YY, but i need the format to be YY-MM-DD.

No, I need to see all the codes.

alright. I'm using jquery by the way. So here the code.

viewReservation.php

<?php 
include('header.php');
?>	
    <h1>Book appointment</h1>
       <?php
            $idUser = $_GET['id'];
            
           /* $dbConn = mysqli_connect(DBSERVER,DBUSER,DBPASS,DBNAME) or die(mysqli_connect_error());
            $viewquery = "";
            $viewResult = mysqli_query($dbConn,$viewquery) or die(mysqli_error($dbConn));*/
         ?>
   
            <Form name ="form" method ="post" action = "bookReservation.php" >
            <p>Choose Date: <input type="text" name ="date" id="datepicker">
               Choose Time Slot:<select name ="time" id ="select">
               <option>--</option>
               <option>11:00:00-12:00:00</option>
               <option>13:00:00-14:00:00</option>
               <option>15:00:00-16:00:00</option>
               <option>19:00:00-20:00:00</option>
               </select>
               <input type ="hidden" name ="id" value =<?php "$idUser"?>>
               <input type ="submit" value ="Book!">
            </p>
            </form>
    

      

<?php
include('end.php');
?>

header.php

<!-- Add the database connection here -->
<?php 
include "dbconfig.inc.php";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sally Hairstyling</title>
<link href="template.css" rel="stylesheet" type="text/css" />

		<link type="text/css" href="css/sunny/jquery-ui-1.8.6.custom.css" rel="stylesheet" />	
		<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript" src="js/jquery-ui-1.8.6.custom.min.js"></script>
		<script type="text/javascript">
		// increase the default animation speed to exaggerate the effect
			$.fx.speeds._default = 1000;
			//tabs
			$(function(){
				$( "#tabs" ).tabs();
                        //button
                                $( "button, input:submit, a", ".demo" ).button();
                                $( "a", ".demo" ).click(function() { return false; });
			//dialog	
				$( "#dialog" ).dialog({
					autoOpen: false,
					show: "blind",
					hide: "explode"
				});

				$( "#opener" ).click(function() {
					$( "#dialog" ).dialog( "open" );
					return false;
				});
			
					
			// Datepicker
				$('#datepicker')
					.datepicker({
						inline: true,
						createButton:false,
						displayClose:true,
						closeOnSelect:false,
						selectMultiple:true,
						numSelectable:3
                                                
					})
					.bind(
						'dateSelected',
						function(e, selectedDate, $td, state)
						{
							console.log('You ' + (state ? '' : 'un') // wrap
								+ 'selected ' + selectedDate);
							
						}
					)
					.bind(
						'dpClosed',
						function(e, selectedDates)
						{
							console.log('You closed the date picker and the ' // wrap
								+ 'currently selected dates are:');
							console.log(selectedDates);
						}
					)
					;
			});
			
			</script>
</head>
<body>
<div id="template_container">
  <div id="template_header">
    <div id="template_site_title">Sally Hairstyling</div>
    
    <div class="template_menu">
      <ul>
        <li><a href="#" class="current">Main Page</a></li>
        <li><a href="login.php">Login</a> </li>
        <li><a href="#">Register</a> </li>
        <li><a href="#">About Us</a> </li>
        <li><a href="#">Portfolio</a></li>
        <li><a href="#">Services</a></li>
        <li><a href="#">Products</a></li>
        <li><a href="#">Contact us</a></li>
      </ul>
    </div>
  </div>
    <div id="template_header_pic">
      <div id="template_slogan">We provide the best quality service for you.</div>
      <div id="template_slogan_text">Sally hairstyle.</div>
    </div>
    
  <div id="template_content">
    <div id="template_top">
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.