Welcome To My Webboard

เพื่อแลกเปลี่ยนความรู้, ถาม-ตอบปัญหาคาใจ, แนะนำ, ประกาศ, หรือทุกสิ่งตามต้องการ

[ หน้าหลักเว็บบอร์ด | ตั้งกระทู้ใหม่ | สมัครสมาชิก ]

สอบถามเรื่องการใช้checkboxครับ




:: วัน / เวลาตั้งกระทู้ ::
26/07/2559 - 17:35:29 น.

ผมต้องการให้สามารถติ๊กcheckboxเลือกข้อมูลก่อนกดsearch

แล้วพอกดsearchก็แสดงข้อมูลออกมาเป็นtable

<html>
<head>
<title>SEARCH PART</title>
<script type="text/javascript">
<!--
function showMe (it, box) {
var vis = (box.checked) ? "block" : "none";
document.getElementById(it).style.display = vis;
}
//-->
</script>


</head>
<body>
<form name = "search" method = "GET" action = "<?php echo $_SERVER['SCRIPT_NAME'];?>" onSubmit="return check(this)">
    <table width = "800" border = "0" align = "center">PART NO.
      <input name = "txtKeyword" type = "text" id = "txtKeyword" value = "<?php echo $_GET["txtKeyword"];?>">
  
<input type="submit" name="onclick" id="onclick" onClick="function showMe (it, box)" value="Search">
<br><br>
<input type="checkbox" name="modtype" value="value1" onClick="showMe('div1', this)" />Equipment
<input type="checkbox" name="modtype" value="value2" onClick="showMe('div2', this)" />Laptop
<input type="checkbox" name="modtype" value="value3" onClick="showMe('div3', this)" />Desktop
<input type="checkbox" name="modtype" value="value4" onClick="showMe('div4', this)" />Software
 </table>
 </form>
 <form action = "updaterecord.php?partno=<?php echo $_GET["txtKeyword"];?>" name = "frmEdit" method = "POST" >
<?php
if($_GET["txtKeyword"] != "")
 {
 $objConnect = mysql_connect("localhost","root","123456") or die("Error Connect to Database");
 $objDB = mysql_select_db("stock");
 //Search By part no.
 $strSQL = "SELECT * FROM tbl_part WHERE partno = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_part WHERE model = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_part WHERE type = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_part WHERE description = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_part WHERE sn = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_part WHERE po = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_part WHERE companame = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_part WHERE bin = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_part WHERE plant = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_part WHERE warranty = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_part WHERE status = '".$_GET["txtKeyword"]."' ";
 $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
  <p>&nbsp;</p>
 <div id = "div1">
 <table width = "1260" border = "1">
 <tr>
   <th width = "20" align = "center"> ID </th>
   <th width = "120" align = "center"> Part No. </th>
   <th width = "100" align = "center"> Model </th>
   <th width = "80" align = "center"> Type </th>
   <th width = "180" align = "center"> Description </th>
   <th width = "100" align = "center"> Serial No. </th>
   <th width = "100" align = "center"> PO No. </th>
   <th width = "100" align = "center"> Supplier </th>
   <th width = "100" align = "center"> Store bin </th>
   <th width = "80" align = "center"> Plant </th>
         <th width = "100" align = "center"> Warrant </th>
   <th width = "100" align = "center"> Status </th>
  </tr> 
<?php
 while($objResult = mysql_fetch_array($objQuery))
 {
?>
  <tr>
   <td align = "center"><?php echo $objResult["id"];?></td>
   <td align = "center"><input type = "text" name = "txtpartno" size = "15" value = "<?php echo $objResult["partno"];?>"></td>
   <td align = "center"><input type = "text" name = "txtmodel" size = "10" value = "<?php echo $objResult["model"];?>"></td>
   <td align = "center"><input type = "text" name = "txttype" size = "10" value = "<?php echo $objResult["type"];?>"></td>
   <td align = "center"><input type = "text" name = "txtdescription" size = "25" value = "<?php echo $objResult["description"];?>"></td>
   <td align = "center"><input type = "text" name = "txtsn" size = "10" value = "<?php echo $objResult["sn"];?>"></td>
   <td align = "center"><input type = "text" name = "txtpo" size = "10" value = "<?php echo $objResult["po"];?>"></td>
   <td align = "center"><input type = "text" name = "txtcompaname" size = "10" value = "<?php echo $objResult["companame"];?>"></td>
   <td align = "center"><input type = "text" name = "txtbin" size = "10" value = "<?php echo $objResult["bin"];?>"></td>
   <td align = "center"><input type = "text" name = "txtplant" size = "10" value = "<?php echo $objResult["plant"];?>"></td>
   <td align = "center"><input type = "text" name = "txtwarranty" size = "10" value = "<?php echo $objResult["warranty"];?>"></td>
   <td align = "center"><input type = "text" name = "txtstatus" size = "10" value = "<?php echo $objResult["status"];?>"></td>
  </tr>
<?php
 }
?>
 </table>
 <input type = "submit" name = "submit" value = "submit">
 </div>
 
<?php
  }
  ?>
</form>
<form action = "updatelaptop.php?comname=<?php echo $_GET["txtKeyword"];?>" name = "frmEdit" method = "POST" >
<?php
if($_GET["txtKeyword"] != "")
 {
 $objConnect = mysql_connect("localhost","root","123456") or die("Error Connect to Database");
 $objDB = mysql_select_db("stock");
 //Search By part no.
 $strSQL = "SELECT * FROM tbl_laptop WHERE comname = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_laptop WHERE model = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_laptop WHERE tag = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_laptop WHERE site = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_laptop WHERE mouse = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_laptop WHERE adapter = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_laptop WHERE companame = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_laptop WHERE user = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_laptop WHERE position = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_laptop WHERE depart = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_laptop WHERE warranty = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_laptop WHERE status = '".$_GET["txtKeyword"]."' ";
 $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
  <p>&nbsp;</p>
 <div id = "div2">
 <table width = "1200" border = "1">
  <tr>
   <th width = "20" align = "left"> ID </th>
   <th width = "50" align = "left"> Computer Name </th>
   <th width = "50" align = "left"> Model </th>
   <th width = "50" align = "left"> Tag </th>
   <th width = "30" align = "left"> Site </th>
   <th width = "50" align = "left"> Mosuse </th>
   <th width = "50" align = "left"> Adapter </th>
   <th width = "50" align = "left"> Supplier </th>
   <th width = "30" align = "left"> User </th>
   <th width = "50" align = "left"> Position </th>
   <th width = "50" align = "left"> Department </th>
   <th width = "50" align = "left"> Warranty </th>
   <th width = "50" align = "left"> Status </th>
  </tr> 
<?php
 while($objResult = mysql_fetch_array($objQuery))
 {
?>
  <tr>
   <td align = "center"><?php echo $objResult["id"];?></td>
   <td align = "center"><input type = "text" name = "txtcomname" size = "10" value = "<?php echo $objResult["comname"];?>"></td>
   <td align = "center"><input type = "text" name = "txtmodel" size = "10" value = "<?php echo $objResult["model"];?>"></td>
   <td align = "center"><input type = "text" name = "txttag" size = "10" value = "<?php echo $objResult["tag"];?>"></td>
   <td align = "center"><input type = "text" name = "txtsite" size = "10" value = "<?php echo $objResult["site"];?>"></td>
   <td align = "center"><input type = "text" name = "txtmouse" size = "10" value = "<?php echo $objResult["mouse"];?>"></td>
   <td align = "center"><input type = "text" name = "txtadapter" size = "10" value = "<?php echo $objResult["adapter"];?>"></td>
   <td align = "center"><input type = "text" name = "txtcompaname" size = "10" value = "<?php echo $objResult["companame"];?>"></td>
   <td align = "center"><input type = "text" name = "txtuser" size = "10" value = "<?php echo $objResult["user"];?>"></td>
   <td align = "center"><input type = "text" name = "txtposition" size = "10" value = "<?php echo $objResult["position"];?>"></td>
   <td align = "center"><input type = "text" name = "txtdepart" size = "10" value = "<?php echo $objResult["depart"];?>"></td>
   <td align = "center"><input type = "text" name = "txtwarranty" size = "10" value = "<?php echo $objResult["warranty"];?>"></td>
   <td align = "center"><input type = "text" name = "txtstatus" size = "10" value = "<?php echo $objResult["status"];?>"></td>
  </tr>
<?php
 }
?>
 </table>
 <input type = "submit" name = "submit" value = "submit">
   </div>
 
<?php
}
?>
</form>
<form action = "updatedesktop.php?desktop=<?php echo $_GET["txtKeyword"];?>" name = "frmEdit" method = "POST" >
<?php
if($_GET["txtKeyword"] != "")
 {
 $objConnect = mysql_connect("localhost","root","123456") or die("Error Connect to Database");
 $objDB = mysql_select_db("stock");
 //Search By part no.
 $strSQL = "SELECT * FROM tbl_desktop WHERE desktop = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_desktop WHERE model = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_desktop WHERE tag = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_desktop WHERE display = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_desktop WHERE site = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_desktop WHERE mouse = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_desktop WHERE keyboard = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_desktop WHERE companame = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_desktop WHERE user = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_desktop WHERE position = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_desktop WHERE depart = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_desktop WHERE warranty = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_desktop WHERE status = '".$_GET["txtKeyword"]."' ";
 $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
  <p>&nbsp;</p>
 <div id = "div3">
 <table width = "1200" border = "1">
  <tr>
   <th width = "20" align = "left"> ID </th>
   <th width = "50" align = "left"> Computer Name </th>
   <th width = "50" align = "left"> Model </th>
   <th width = "50" align = "left"> Tag </th>
   <th width = "50" align = "left"> Monitor </th>
   <th width = "50" align = "left"> Site </th>
   <th width = "50" align = "left"> Mouse </th>
   <th width = "50" align = "left"> Keyboard </th>
   <th width = "50" align = "left"> Supplier </th>
   <th width = "50" align = "left"> User </th>
   <th width = "50" align = "left"> Position </th>
   <th width = "50" align = "left"> Department </th>
   <th width = "50" align = "left"> Warranty </th>
   <th width = "50" align = "left"> Status </th>
  </tr>
<?php
 while($objResult = mysql_fetch_array($objQuery))
 {
?>
  <tr>
   <td align = "center"><?php echo $objResult["id"];?></td>
   <td align = "center"><input type = "text" name = "txtdesktop" size = "10" value = "<?php echo $objResult["desktop"];?>"></td>
   <td align = "center"><input type = "text" name = "txtmodel" size = "10" value = "<?php echo $objResult["model"];?>"></td>
   <td align = "center"><input type = "text" name = "txttag" size = "10" value = "<?php echo $objResult["tag"];?>"></td>
   <td align = "center"><input type = "text" name = "txtdisplay" size = "10" value = "<?php echo $objResult["display"];?>"></td>
   <td align = "center"><input type = "text" name = "txtsite" size = "10" value = "<?php echo $objResult["site"];?>"></td>
   <td align = "center"><input type = "text" name = "txtmouse" size = "10" value = "<?php echo $objResult["mouse"];?>"></td>
   <td align = "center"><input type = "text" name = "txtkeyboard" size = "10" value = "<?php echo $objResult["keyboard"];?>"></td>
   <td align = "center"><input type = "text" name = "txtcompaname" size = "10" value = "<?php echo $objResult["companame"];?>"></td>
   <td align = "center"><input type = "text" name = "txtuser" size = "10" value = "<?php echo $objResult["user"];?>"></td>
   <td align = "center"><input type = "text" name = "txtposition" size = "10" value = "<?php echo $objResult["position"];?>"></td>
   <td align = "center"><input type = "text" name = "txtdepart" size = "10" value = "<?php echo $objResult["depart"];?>"></td>
   <td align = "center"><input type = "text" name = "txtwarranty" size = "10" value = "<?php echo $objResult["warranty"];?>"></td>
   <td align = "center"><input type = "text" name = "txtstatus" size = "10" value = "<?php echo $objResult["status"];?>"></td>
  </tr>
<?php
 }
?>
 </table>
 <input type = "submit" name = "submit" value = "submit">
 </div>
 
<?php
  }
  ?>
</form>
<form action = "updatesoftware.php?softname=<?php echo $_GET["txtKeyword"];?>" name = "frmEdit" method = "POST" >
<?php
if($_GET["txtKeyword"] != "")
 {
 $objConnect = mysql_connect("localhost","root","123456") or die("Error Connect to Database");
 $objDB = mysql_select_db("stock");
 //Search By part no.
 $strSQL = "SELECT * FROM tbl_software WHERE softname = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_software WHERE contactno = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_software WHERE productno = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_software WHERE sn = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_software WHERE description = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_software WHERE location = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_software WHERE companame = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_software WHERE warranty = '".$_GET["txtKeyword"]."' ";
 //$strSQL = "SELECT * FROM tbl_software WHERE status = '".$_GET["txtKeyword"]."' ";
 $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
  <p>&nbsp;</p>
 <div id = "div4">
 <table width = "1200" border = "1">
  <tr>
   <th width = "20" align = "left"> ID </th>
   <th width = "20" align = "left"> Software Name </th>
   <th width = "50" align = "left"> Contact No. </th>
   <th width = "50" align = "left"> Product No. </th>
   <th width = "50" align = "left"> Serial No. </th>
   <th width = "50" align = "left"> Description </th>
   <th width = "50" align = "left"> Location </th>
   <th width = "50" align = "left"> Supplier </th>
   <th width = "50" align = "left"> Warranty </th>
   <th width = "50" align = "left"> Status </th>
  </tr>
<?php
 while($objResult = mysql_fetch_array($objQuery))
 {
?>
  <tr>
   <td align = "center"><?php echo $objResult["id"];?></td>
   <td align = "center"><input type = "text" name = "txtsoftname" size = "10" value = "<?php echo $objResult["softname"];?>"></td>
   <td align = "center"><input type = "text" name = "txtcontactno" size = "10" value = "<?php echo $objResult["contactno"];?>"></td>
   <td align = "center"><input type = "text" name = "txtproductno" size = "10" value = "<?php echo $objResult["productno"];?>"></td>
   <td align = "center"><input type = "text" name = "txtsn" size = "10" value = "<?php echo $objResult["sn"];?>"></td>
   <td align = "center"><input type = "text" name = "txtdescription" size = "10" value = "<?php echo $objResult["description"];?>"></td>
   <td align = "center"><input type = "text" name = "txtlocation" size = "10" value = "<?php echo $objResult["location"];?>"></td>
   <td align = "center"><input type = "text" name = "txtcompaname" size = "10" value = "<?php echo $objResult["companame"];?>"></td>
   <td align = "center"><input type = "text" name = "txtwarranty" size = "10" value = "<?php echo $objResult["warranty"];?>"></td>
   <td align = "center"><input type = "text" name = "txtstatus" size = "10" value = "<?php echo $objResult["status"];?>"></td>
  </tr>
<?php
 }
?>
 </table>
 <input type = "submit" name = "submit" value = "submit">
 </div>
<?php
  }
  ?>
</form>
</body>
</html>

</body>
</html>






<< มีทั้งหมด 0 ความคิดเห็น >>





ยังไม่มีผู้มาแสดงความคิดเห็น



<< เพิ่มความคิดเห็น >>
* ข้อความ :   
* โดย :   
* อีเมล์ :   
เบอร์โทรศัพท์ :   
ไฟล์ประกอบ :   
รูปภาพประกอบ :   
Security Code :   
Audio Version
Reload Image
* กรอก Security Code :   
<< ตั้งรหัสผ่านสำหรับ แก้ไข/ลบ ความคิดเห็นของคุณ >>

:: โปรดกรอกรหัสผ่านที่ต้องการใช้ ในการแก้ไข/ลบ ความคิดเห็นที่ท่านได้โพสไว้ ::


[ ไม่เกิน 20 ตัวอักษร ]