|
|
|
ใครเก่ง php ช่วยหน่อยค่ะ ทำไม select ข้อมูลขึ้นมาแล้วมันรีโหลดอ่ะคะ ไม่เข้าใจ |
|
|
|
|
|
|
|
โค้ดนี้พอใช้ได้ค่ะ แต่ลักไก่เอาบรรยากาศไว้ข้างบนได้ไม่รีโหลด แต่ atm_id มันไม่ลงฐานอ่ะค่ะ ช่วยที
Code (PHP)
<table width="98%" height="124" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td width="17%" height="15" valign="top"><div align="right" class="style14 style16">
<div align="right">บรรยากาศ : </div>
</div></td>
<td colspan="2" valign="top"><select name="atm" onchange="window.location='?select='+this.value+'&lmName1=<?php echo $_REQUEST['lmName1'] ?>'">
<option value=""><-- Please Select Item --></option>
<?
$strSQL = "SELECT * FROM atmosphere ORDER BY atm_id ASC";
$objQuery = mysql_query($strSQL);
while($objResult = mysql_fetch_array($objQuery))
{
if($_REQUEST["select"] == $objResult["atm_id"])
{
$sel = "selected";
}
else
{
$sel = "";
}
?>
<option value="<?=$objResult["atm_id"];?>" <?=$sel;?>>
<?=$objResult["atm_name"];?>
<?=$objResult["atm_id"];?>
</option>
<?
}
?>
</select>
<?
if($_REQUEST["select"] != "")
{
$strSQL = "SELECT * FROM atmosphere WHERE atm_id = '".$_REQUEST["select"]."' ";
$objQuery = mysql_query($strSQL);
$objResult2 = mysql_fetch_array($objQuery);
$atm_price = $objResult2["atm_price"];
}
?>
<input name="atm_price" type="text" disabled="disabled" id="atm_price" value="<? echo number_format($atm_price,2) ?> " size="10" />
</p></td>
</tr>
<tr>
<td height="15" valign="top"><div align="right" class="style14 style16">
<div align="right">ประเภทห้องพัก : </div>
</div></td>
<td colspan="2" valign="top"><p><span class="style13 style14">
<select name="room_type" onchange="window.location='?room_type='+this.value+'&select=<?php echo $_REQUEST['select'] ?>'">
<option value=""><-- Please Select Item --></option>
<?
$strSQL = "SELECT * FROM room_type ORDER BY roomTypeID ASC";
$objQuery = mysql_query($strSQL);
while($objResult = mysql_fetch_array($objQuery))
{
if($_REQUEST["room_type"] == $objResult["roomTypeID"])
{
$sel = "selected";
}
else
{
$sel = "";
}
?>
<option value="<?=$objResult["roomTypeID"];?>" <?=$sel;?>>
<?=$objResult["roomTypeName"];?>
<?=$objResult["roomTypeID"];?>
</option>
<?
}
?>
</select>
*
<?
if($_REQUEST["room_type"] != "")
{
$strSQL = "SELECT * FROM room_type WHERE roomTypeID = '".$_REQUEST["room_type"]."' ";
$objQuery = mysql_query($strSQL);
$objResult2 = mysql_fetch_array($objQuery);
$Price = $objResult2["Price"];
}
?>
<input name="Price" type="text" disabled="disabled" id="Price" value="<? echo number_format($Price,2) ?> " size="10" />
</span></p></td>
</tr>
<tr>
<td height="15" valign="top"><div align="right" class="style14 style16">
<div align="right">ราคาขาย : </div>
</div></td>
<td colspan="2" valign="top"><? $sale= $Price+$atm_price?>
<input name="sale" type="text" id="sale" value="<? echo ($sale); ?> " size="10" r /> </td>
</tr>
<tr>
<td height="15" valign="top"><div align="right" class="style14 style16">
<div align="right">ราคาเช่า/ผ่อน :: </div>
</div></td>
<td colspan="2" valign="top"><? $rent= (($sale*0.02))?>
<input name="rent" type="text" id="rent" value="<? echo($rent); ?> " size="10" readonly/></td>
</tr>
<tr>
<td height="15" valign="top"><div align="right" class="style14 style16">
<div align="right">ชั้น : </div>
</div></td>
<td colspan="2" valign="top"><span class="style13 style14">*
<select name="floor" id="floor">
<option value="0">--------เลือก------</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
</span></td>
</tr>
<tr>
<td height="16" valign="top"><div align="right" class="style14 style16">
<div align="right">รายละเอียด : </div>
</div></td>
<td width="35%" valign="top"><textarea name="roomdetail" cols="40" id="roomdetail"></textarea></td>
<td width="48%" valign="top"><span class="style13 style14">*
</span></td>
</tr>
<tr>
<td height="31" valign="top"><div align="right" class="style14 style16">
<div align="right">สถานะ : </div>
</div></td>
<td colspan="2" valign="top"><select name="roomstatus" id="roomstatus">
<option value="0">--เลือก--</option>
<option value="0">ว่าง</option>
<option value="1">ไม่ว่าง</option>
</select>
<span class="style13 style14">*</span></td>
</tr>
<tr>
<td valign="top"><div align="right"><span class="style14"><span class="style15"></span></span></div></td>
<td colspan="2" valign="top"><input name="button" type="submit" id="button" value="บันทึกข้อมูล" /> <span class="style14"></span></td>
</tr>
</table>
|
|
|
|
|
Date :
2014-01-20 18:59:45 |
By :
aumm |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|