i have a problem to create a booking page. i currently develop a lend/borrow hardware system. my friend want me to include a list of items that still available and not been borrowed yet based on date chosen before user want to continue booking( ex: hotel reservation 'check availability'). i already try based on any reference that i found, seem it doesn't work at all and i'm confused.most of the reference are focus on database, but how about the form and others.i really need somebody to help with a simple coding and easy to understand. tq

Submit your source code ?

this is page where i want to display the available hardware

<?php require_once('Connections/iventori.php'); ?>
<?php
$id = $_GET['idpinjaman'];

$colname_Recordset1 = "-1";
if (isset($_GET['idpinjaman'])) {
  $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['idpinjaman'] : addslashes($_GET['idpinjaman']);
}


mysql_select_db($database_pinjaman, $pinjaman);
$query_set1 =sprintf("SELECT * FROM pemohon a,pinjaman b WHERE a.id_pemohon=b.id_pemohon AND b.id_pinjaman='%s'", $colname_Recordset1);
$set1 = mysql_query($query_set1, $pinjaman) or die(mysql_error());
$row_set1 = mysql_fetch_assoc($set1);
$totalRows_set1 = mysql_num_rows($set1);

mysql_select_db($database_pinjaman, $pinjaman);
$query_set2 =sprintf("SELECT * FROM inventori");
$set2 = mysql_query($query_set2, $pinjaman) or die(mysql_error());
$row_set2 = mysql_fetch_assoc($set2);
$totalRows_set2 = mysql_num_rows($set2);

mysql_select_db($database_pinjaman, $pinjaman);
$query_set3 =sprintf("SELECT * FROM peralatan");
$set3 = mysql_query($query_set3, $pinjaman) or die(mysql_error());
$row_set3 = mysql_fetch_assoc($set3);
$totalRows_set3 = mysql_num_rows($set3);

mysql_select_db($database_pinjaman, $pinjaman);
$query_set4 =sprintf("SELECT * FROM stock");
$set4 = mysql_query($query_set4, $pinjaman) or die(mysql_error());
$row_set4= mysql_fetch_assoc($set4);
$totalRows_set4 = mysql_num_rows($set4);

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
//insert untuk maklumat peminjam
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) 
{
        $id_pemohon=$_POST['id_pemohon'];
        $tujuan=$_POST['tujuan'];
        $date1=$_POST['date1'];
        $date2=$_POST['date2'];




 $insertSQL = sprintf("INSERT INTO pinjaman (id_pemohon, tujuan, start_pinjaman, last_pinjaman) VALUES ('$id_pemohon', '$tujuan', '$date1', '$date2')");

  mysql_select_db($database_pinjaman, $pinjaman);
  $Result = mysql_query($insertSQL, $pinjaman) or die(mysql_error());

$currentPage = $_SERVER["PHP_SELF"];
}

?>


<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
  <script>
  $(document).ready(function() {
    $("#datepicker").datepicker({ dateFormat: "dd/mm/yy" });
      $("#datepicker2").datepicker({ dateFormat: "dd/mm/yy" });
        });
           </script>

<!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=iso-8859-1" />
<title>Sistem e-Pinjaman</title>
</head>
<style type="text/css">
<!--

body {
background-image: url(image/background.jpg);
}
.style12{font-family: "Times New Roman";font-size: 18px;color: #000000;font-weight:bold;}
.style13 {font-size: 12px; color: #000000; font-family: "Times New Roman";}

-->

   /* Begin Navigation Bar Styling */
   #nav {
      width: 100%;
      float: left;
      margin: 0 0 3em 0;
      padding: 0;
      list-style: none;
      background-color: #FFFF66;
      border-bottom: 1px solid #ccc; 
      border-top: 1px solid #ccc; }
   #nav li {
      float: left; }
   #nav li a {
      display: block;
      padding: 8px 15px;
      text-decoration: none;
      font-weight: bold;
      color: #069;
      border-right: 1px solid #ccc; }
   #nav li a:hover {
      color: #c00;
      background-color: #fff; }
   /* End navigation bar styling. */

   /* This is just styling for this specific page. */
   body {
      background-color: #555; 
      font: small/1.3 Arial, Helvetica, sans-serif; }
   #wrap {
      width: 871px;
      margin: 0 auto;
      background-color: #fff; }
   h1 {
      font-size: 1.5em;
      padding: 1em 8px;
      color: #333;
      background-color: #069;
      margin: 0; }
   #content {
      padding: 0 50px 50px; }
</style>

  <style type="text/css">
    .ui-datepicker {
        font-family: Garamond;
        font-size: 15px;
        margin-left:10px
     }
.style21 {font-family: "Times New Roman", Times, serif}
  </style>

<style type="text/css">
<!-- 
body {
background-image: url(image/background.jpg);
}
.style3 {font-family: "Times New Roman";font-size: 14px;color: #000000;    }
.style1 {
    font-family: "Times New Roman";
    font-size: 16px;
    color: #000000;
    font-weight:bold;

}
.style12{font-family: "Times New Roman";font-size: 18px;color: #000000;font-weight:bold;}

-->
</style>
<body>

      <table width="877" height="483" border="0" align="center" bgcolor="#FFFFCC">
              <tr>
                <td><img src="image/banner.jpg" width="871" height="122" /></td>
              </tr>


              <tr><!--menubar-->
                <td height="141"><!--menubar-->
                <div id="wrap"><!--menubar-->
                 <ul id="nav"><!--menubar-->
                  <li><a href="index.php" class="style1">Laman Utama</a></li><!--menubar-->
                  <li><a href="pinjaman_1.php" class="style1">Pinjaman</a></li><!--menubar-->
                  <li><a href="#" class="style1">Tempahan</a></li><!--menubar-->
                  <li><a href="listperalatanpage.php" class="style1">List peralatan</a></li><!--menubar-->
                  <li><a href="daftar_1.php" class="style1">Daftar Peralatan</a></li><!--menubar-->
                  <li><a href="staff_daftar.php" class="style1">Daftar Pengguna</a></li><!--menubar-->
                  <li><a href="logmasuk.php" class="style1">Log Masuk</a></li><!--menubar-->
                 </ul><!--menubar-->
               </div><!--menubar-->               
               </td><!--menubar-->
              </tr><!--menubar-->

                <tr><!--time&date-->
                    <td width="872" align="right" span class="style1"><!--time&date-->
                    <?php $today = gmdate("j F Y, g:i a",time()+(28800)); ?><!--time&date-->
                    <?php echo $today;?>
                    </td><!--time&date-->
                </tr><!--time&date-->

                    <tr>
                        <td width="871" height="22"><p align="center" class="style12"> MAKLUMAT TEMPAHAN </p></td>
                    </tr>
                    <tr>
                    <td colspan="5" align="center">&nbsp;</td>
                    </tr>

                        <tr>
                            <td>
                                <table align="center" width="400">
                                        <tr>
                                            <td>Nama Peminjam</td>
                                            <td>:</td>
                                            <td><?php echo $row_set1['Nama']; ?></td>
                                        </tr>
                                        <tr>
                                            <td>Jawatan</td>
                                            <td>:</td>
                                            <td><?php echo $row_set1['Jawatan']; ?></td>
                                        </tr>
                                        <tr>
                                            <td>Bahagian</td>
                                            <td>:</td>
                                            <td><?php echo $row_set1['Bahagian']; ?></td>
                                        </tr>
                                        <tr>
                                            <td>Telefon</td>
                                            <td>:</td>
                                            <td><?php echo $row_set1['Tel']; ?></td>
                                        </tr>
                                        <tr>
                                            <td>Tempoh Pinjaman</td>
                                            <td>:</td>
                                            <td><?php echo $row_set1['start_pinjaman']; ?> - <?php echo $row_set1['last_pinjaman']; ?></td>
                                        </tr>
                                        <tr>
                                            <td>Tujuan Pinjaman</td>
                                            <td>:</td>
                                            <td><?php echo $row_set1['tujuan']; ?></td>
                                        </tr>
                                </table>
                            </td>
                        </tr>
                                        <tr>
                                            <td colspan="5" align="center">&nbsp;</td>
                                        </tr>
                                                <tr>
                                                    <td width="871" height="22"><p align="center" class="style12"> PERALATAN </p></td>
                                                </tr>
                                        <tr>
                                            <td colspan="5" align="center">&nbsp;</td>
                                        </tr>


                <tr>
                    <td>
                        <p align="center">&nbsp; </p>
                        <p align="center"><span class="style13">&nbsp;Hakcipta Terpelihara 2013. Jabatan Agama Islam Selangor&copy;</a>. <br />
                          </span></p>
                    </td>
                </tr>

</table>
</body>
</html>

this table is get start_pinjaman/last_pinjaman(date) and tujuan(purpose) from user
table: pinjaman
column:id_pinjaman, id_pemohon, tujuan, start_pinjaman, last_pinjaman

after the user choose the available hardware, the data will go into this table. In other word it is a booking table
table:peralatan
column:id_peralatan, id_pinjaman, id_inventori, status

this table is the inventori
table:inventori
column:id_inventori, no_inventori, peralatan, model

it is better if u can show me other easier way

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.