here is my coding. i want user unable to select data in select box once it is selected in the first select box(hide/remove).i add the javascript. but its not working. any solution?

peralatan.php

<?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);


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['1'];
        $date2=$_POST['2'];




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

  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>
           <script>
           var selects = $('select');

            selects.change(function() {
                var vals = {};    
                selects.each(function() { vals[this.value] = true; }).get();
                selects.not(this).children().not(':selected').not(':first-child')
                    .each(function() { this.disabled = vals[this.value]; });
            });
            </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="1000" 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="495">
                                        <tr>
                                            <td width="113">Nama Peminjam</td>
                                            <td width="4">:</td>
                                            <td width="345"><?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>
                                        <table width="956" border="1" align="center" bgcolor="#0099FF">
                                                <tr bgcolor="#999999">
                                                    <td width="148"><div align="center">LAPTOP</div></td>
                                                    <td width="148"><div align="center">PROJEKTOR</div></td>
                                                    <td width="148"><div align="center">LAYAR</div></td>
                                                    <td width="148"><div align="center">EXTENSION</div></td>
                                                    <td width="148"><div align="center">LAIN-LAIN</div></td>
                                                </tr>

                                                <tr bgcolor="FFFFFF">
                                                    <td width="148"  bgcolor="FFFFFF"><div align="center">
                                                    <select>
                                                        <option></option>
                                                        <option value="a"> Audi </option>
                                                        <option value="b"> BMW </option>
                                                        <option value="c"> Citroen </option>
                                                        <option value="d"> Daihatsu </option>
                                                        <option value="f"> Fiat </option>
                                                        <option value="h"> Hyundai </option>
                                                    </select></div></td>

                                                    <td width="148" bgcolor="FFFFFF"><div align="center">
                                                    <select>
                                                        <option></option>
                                                        <option value="a"> Audi </option>
                                                        <option value="b"> BMW </option>
                                                        <option value="c"> Citroen </option>
                                                        <option value="d"> Daihatsu </option>
                                                        <option value="f"> Fiat </option>
                                                        <option value="h"> Hyundai </option>
                                                    </select></div></td>
                                                    <td width="148"  bgcolor="FFFFFF"><div align="center">
                                                    <select>
                                                        <option></option>
                                                        <option value="a"> Audi </option>
                                                        <option value="b"> BMW </option>
                                                        <option value="c"> Citroen </option>
                                                        <option value="d"> Daihatsu </option>
                                                        <option value="f"> Fiat </option>
                                                        <option value="h"> Hyundai </option>
                                                    </select></div></td>
                                                    <td width="148" bgcolor="FFFFFF"><div align="center">
                                                    <select>
                                                        <option></option>
                                                        <option value="a"> Audi </option>
                                                        <option value="b"> BMW </option>
                                                        <option value="c"> Citroen </option>
                                                        <option value="d"> Daihatsu </option>
                                                        <option value="f"> Fiat </option>
                                                        <option value="h"> Hyundai </option>
                                                    </select></div></td>
                                                    <td width="148" bgcolor="FFFFFF"><div align="center">
                                                    <select>
                                                        <option></option>
                                                        <option value="a"> Audi </option>
                                                        <option value="b"> BMW </option>
                                                        <option value="c"> Citroen </option>
                                                        <option value="d"> Daihatsu </option>
                                                        <option value="f"> Fiat </option>
                                                        <option value="h"> Hyundai </option>
                                                    </select></div></td>
                                                </tr>
                                        </table>
                                    </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>
Member Avatar for diafol

Your html is all mashed. You have the html doc insode a head area:

<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>
           <script>
           var selects = $('select');
            selects.change(function() {
                var vals = {};    
                selects.each(function() { vals[this.value] = true; }).get();
                selects.not(this).children().not(':selected').not(':first-child')
                    .each(function() { this.disabled = vals[this.value]; });
            });
            </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>

BTW, if this is a JS issue - you should post to the javascript forum.

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.