<label>Promotion Name</label> <input type="text" id="proname" name="proname" > <label>Promotion Type</label><br> <select multiple id="selectType" name="selectType[]"> <?php $query = mysql_query("SELECT * FROM promotion_type"); while ($data = mysql_fetch_array($query)) { ?> <option value="<?php echo $data['ID'];?>"><?php echo $data['Name'];?></option> <?php } ?> </select> <a href="javascript:sendAddCondition();"><button type="button"> Add Condition</button></a> <script type="text/javascript"> function sendAddCondition(){ location.href='add-condition.php?name=' + document.getElementById("proname").value + '&selectType=' + document.getElementById("selectType").value; } </script>
<script type="text/javascript"> function sendAddCondition(){ location.href='add-condition.php?name=' + document.getElementById("proname").value + '&selectType=' + document.getElementById("selectType").value; } </script>
<?php if(isset($_REQUEST['selectType'])){ $test=explode(',', $_REQUEST['selectType'] ); }else $test=array(); ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <script type="text/javascript"> function sendAddCondition(){ var var_chk = new Array(); var chk_data = document.getElementsByClassName('chk'); for( var key in chk_data){ if( chk_data[key].checked ){ var ln=var_chk.length; var_chk[ln] = chk_data[key].value; } } location.href='?selectType=' + var_chk; } </script> </head> <body> <pre><?php print_r($test); ?></pre> <input type="checkbox" class="chk" value="type1"> <input type="checkbox" class="chk" value="type2"> <input type="checkbox" class="chk" value="type3"> <button type="button" onClick="sendAddCondition();">send</button> </body> </html>
<?php if(isset($_REQUEST['selectType'])){ $test=explode(',', $_REQUEST['selectType'] ); }else $test=array(); ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <script> function setData(){ var sel = document.getElementById("list1"); var listLength = sel.options.length; var var_chk = new Array() for(var i=0;i<listLength;i++){ if(sel.options[i].selected) var_chk[var_chk.length]=sel.options[i].value; } location.href="?selectType="+var_chk; } </script> </head> <body> <pre><?php print_r($test); ?></pre> <select id="list1" name="RoomID" multiple > <option value="" selected>-- เลือกห้องพัก --</option> <?php $strSQL = "SELECT * FROM `room` order by `floor`, `room_id` "; mysql_query("SET NAMES TIS620"); $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $floor=''; while($objResult = mysql_fetch_array($objQuery)){ if($floor!=$objResult['floor']){ if($floor>'') echo "</optgroup>"; $floor=$objResult['floor']; echo "<optgroup label='Floor $floor'>"; } if( $objResult['rent']=='Yes'){ echo "<option value='$objResult[room_id]' disabled >ห้อง $objResult[room_id] ไม่ว่าง</option>"; }else{ echo "<option value='$objResult[room_id]'>ห้อง $objResult[room_id]</option>"; } } echo "</optgroup>"; ?></select> <button type="button" onClick="setData()">Save</button> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง