<? include ("sess.php"); include("lib.php");		  include ("config.php");   
if($sent_id !=""){
?>
<script>
self.opener.document.form2.id_sent2.value = "<?=$sent_id;?>";
self.opener.document.form2.id_sent2_.value = "<?=$id_sent1;?>";
self.opener.document.form2.submit();
window.close(); 
</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><link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>ค้นหาข้อมูลนักศึกษา</title>
<style type="text/css">
<!--
body {
	background-image: url(images/bg.png);
}
-->
</style>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="400" border="0" align="center">
  <tr>
    <td><fieldset>
    <table width="400" border="0">
          <tr>
            <td width="133"><div align="right"><span class="inputtextCopy" align="right">ค้นหาตามรหัส</span><span align="right" class="inputtext"> :</span></div></td>
            <td width="257">
              <form id="form1" name="form1" method="post" action="search_book.php">
                <span id="sprytextfield1">
                <label>
                <input type="text" name="id_name" id="id_name" />
                <input type="hidden" name="but" value="1"  />
                </label>
                <input type="hidden" name="id_sent1" value="<?=$id_sent1;?>"  />
                <span class="textfieldRequiredMsg">.</span></span>
                                          <input name="button" type="submit" class="menuclick" id="button" value="ค้นหา" />
              </form>
              <label></label></td>
          </tr>

          <tr>
            <td colspan="2">&nbsp;</td>
          </tr>
          <? 
	if($but==1){
		  $sql="select * from tbl_book where 1 and no_id like '%$id_name'";
		//echo $sql; exit();
		  $re=mysql_query($sql);
		  $num=mysql_num_rows($re)

		  ?>
          <tr>
            <td colspan="2"><div align="right">
              <table width="390" border="0">
                <tr>
                  <td width="74" class="menuclick"><div align="center">รหัสหนังสือ</div></td>
                  <td width="111" class="menuclick"><div align="center">ชื่อหนังสือ</div></td>
                  <td width="50" class="menuclick"><div align="center">จำนวน</div></td>
                  <td width="137" class="menuclick"><div align="center">เลือกข้อมูล</div></td>
                </tr>
                <? while ($data=mysql_fetch_array($re)){?>
                <tr>
                  <td class="inputtext"><div align="center">
                    <?=$data[no_id]?>
                  </div></td>
                  <td class="inputtext"><div align="center"><? echo "$data[book_name]";?></div></td>
                  <td class="inputtext"><div align="center"><? echo "$data[book_num]";?></div></td>
                  <td class="inputtext"><div align="center">
                  <? if ($data[book_num]==0){?>
                  <span class="inputtext">ไม่สามารถยืมได้</span>
                  <? }else{ ?>
                  <a href="<? echo " search_book.php?sent_id=$data[id] & id_sent1=$id_sent1";?>">
                  <img src="images/check-1.gif" width="15" height="14" border="0" /></a>
                  <? }?>
                  </div></td>
                </tr><? }?>
              </table>
              <? }?>
            </div></td>
          </tr>
      </table>
   
            </fieldset>
    </td>
  </tr>
</table>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
//-->
</script>
</body>
</html>
