เรื่อง onchang นะ คับ

ผม มี list/Menu แล้วผมยากให้ค่าใน list/Menu ไปอยู่ใน textbox ครับ





<script>

 function when_i_change_product_group(objSelect){

  window.location = 'room_from.php?room_class=' + document.getElementById("room_class").value + "&room_class="  +  document.getElementById("room_class").value;

 }

</script>
07 ก.ย. 2553 3 1,694


code ทั้งหมดคับ

<?

session_start();

include('../connect/connect_db.php');



$SQL="SELECT max(room_number) as num FROM room_tb WHERE room_class='$room_class'";

    $rs=$db->Execute($SQL)or die('ERROR');

    $result=$rs->fields;

    $maxid=$result['num'];

    //echo $maxid;

    //exit();

      if(empty($maxid)){

       $maxid=1;

      }else{

    $maxid=$maxid+1;

   }

?>

<html>

<head>

<title>ข้อมูลห้องพัก</title>

<meta http-equiv="Content-Type" content="text/html; charset=windows-874">

<link rel="stylesheet" type="text/css" href="../system/chrometheme/chromestyle.css" />

<script type="text/javascript" src="../system/chromejs/chrome.js"></script>

<link rel="stylesheet" type="text/css" href="../css/styles.css"/>

<script type="text/javascript" language="javascript" src="../javascript/ck.js"></script>

<script type="text/javascript" src="../javascript/check.js"></script>

</head>

<script>

 function when_i_change_product_group(objSelect){

  window.location = 'room_from.php?room_class=' + document.getElementById("room_class").value + "&room_class="  +  document.getElementById("room_class").value;

 }

</script>


<body>

<table width="100%" cellspacing="0" class="broder">

  <tr>

    <td background="../image/brush113.jpg"><? include('header.php');?></td>

  </tr>

  <tr>

    <td class="header" align="right"><? include('wellcom.php');?></td>

  </tr>

  <tr>

    <td><? include('../system/menu.php'); ?></td>

  </tr>

  <tr>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td><form name="form1" method="post" action="room_save.php">

      <table width="41%" border="1" align="center" cellspacing="0">

        <tr>

          <td colspan="2" align="center" class="header">ข้อมูลห้องพัก</td>

          </tr>


        <tr>

          <td width="28%" height="43" align="right" class="font">เลือกชั้น :</td>

          <td width="72%"><select name="room_class" id="room_class" onChange=" return when_i_change_product_group();">

              <option value="">เลือก</option>

              <option value="1">1</option>

              <option value="2">2</option>

            </select></td>

        </tr>

        <tr>

          <td height="40" align="right" class="font">รหัสห้อง :</td>

          <td><input name="room_number" type="text" id="room_number" value="<? echo $maxid;?>" size="5" maxlength="3"></td>

        </tr>

        <tr>

          <td>&nbsp;</td>

          <td><input name="Submit" type="submit" id="Submit" value="บันทีก" class="button" onClick="return room();">

            <input type="reset" name="Reset" id="Reset" value="ยกเลิก" class="button"></td>

        </tr>

      </table>

      </form></td>

  </tr>

  <tr>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td>&nbsp;</td>

  </tr>

  <tr>

    <td>&nbsp;</td>

  </tr>

</table>

</body>

</html>




 

#1

<script>

 function when_i_change_product_group(objSelect){

  window.location.href = 'room_from.php?room_class=' +
objSelect;

 }

</script>


<select name="room_class" id="room_class" onchange="when_i_change_product_group(this.value);">



กำลังหมายถึงว่าพอเปลี่ยนปุ๊บ ก็ให้มันเปลี่ยนไปหน้า room_form.php?room_class= ใช่ไหมครับ ลองดูครับ ไม่รู้ว่าถูกไหม ยังไม่ได้ลอง แล้วผมสงสัยอย่างนึงว่า room_class ที่ส่งไปกับ php ส่งไปสองอันเลยรึเปล่า??

#2

#3
ความคิดเห็น
ไฟล์อัปโหลด ชนิด jpg, jpeg ขนาดไฟล์ไม่เกิน 1024
^