|
 |
|
ช่วยดูหน่อยครับ ค่าที่ได้ไม่ตรงตามที่เลือก มีเรื่องถามหน่อยครับ คือ ค่าที่ได้มันไม่ตรงกับที่เราเลือกอ่ะครับ |
|
 |
|
|
 |
 |
|
มีเรื่องถามหน่อยครับ คือ ค่าที่ได้มันไม่ตรงกับที่เราเลือกอ่ะครับ

สมมุติว่าผมเลือก checkbox ที่ 1 และ 3
ผมต้องการค่า แบบนี้
ค่าที่ได้มันเป็นแบบนี้ครับ
room id = 169
bed type id = 02
price = 800
active from = 23-04-2009
active to = 25-04-2009
room id = 170
bed type id = 01
price =
active from =
active to =
ซึ่งมันไม่ตรงตามที่เราเลือก และตัวที่ 2 มันก็ไม่แสดงค่า ที่ถูกมันต้องมันต้องเป็นแบบนี้
room id = 169
bed type id = 02
price = 800
active from = 23-04-2009
active to = 25-04-2009
room id = 171
bed type id = 04
price = 3000
active from = 25-04-2009
active to = 28-04-2009
//add_room.php
Code (PHP)
<?php
<table width="550" border="0" class="outline_content">
<tr bgcolor="#99CCFF">
<td width="76" align="center" valign="middle">Room ID</td>
<td width="107" align="center" valign="middle">Bed Type</td>
<td width="85" align="center" valign="middle">Prices</td>
<td width="103" align="center" valign="middle">Active From </td>
<td width="99" align="center" valign="middle">Active to </td>
<td width="52" align="center" valign="middle">Active</td>
</tr>
<?
$sqlStmt = "select max(rmrate_id+1) as maxid, count(*) as recordcount from hotel_rmrate_tsc";
$result = mysql_query($sqlStmt);
$line = mysql_fetch_array($result);
if($line["recordcount"] == 0)
{
$maxId = 1;
}else{
$maxId = $line["maxid"];
}
$nextId = formatStringId($maxId, 3);
?>
<?
for($i=0; $i<10; $i++)
{
?>
<tr>
<td align="center" valign="top"><input name="rmm_id[<?=$i?>]" type="text" id="rmm_id[<?=$i?>]" style="width:60px; text-align:right;" disabled="disabled" value="<?=$nextId?>" /><input type="hidden" value="<?=$nextId?>" name="rmm_id[<?=$i?>]" /></td>
<td align="center" valign="top">
<?
$sql2 = "select * from hotel_bedtype ORDER BY bedtype_id";
$result2 = mysql_query($sql2);
?>
<select name="bedtype_id[<?=$i?>]" id="bedtype_id[<?=$i?>]" style="width: 75px;" >
<?
while($rs2 = mysql_fetch_array($result2))
{
?>
<option value="<?=$rs2[bedtype_id]?>"><?=$rs2[bedtype_name]?></option>
<?
}
?>
</select>
</td>
<td align="center" valign="top">
<input name="rm_prices[<?=$i?>]" type="rm_prices[<?=$i?>]" style="width:70px; text-align:right;" size="10" maxlength="10" />
</td>
<td align="center" valign="top">
<input name="rmrate_activefrom[<?=$i?>]" type="text" id="rmrate_activefrom[<?=$i?>]" style="width: 68px;" size="10" maxlength="10" />
<button id="trigger">.</button>
<script type="text/javascript">//<![CDATA[
Zapatec.Calendar.setup(
{
firstDay : 1,
electric : false,
inputField : "rmrate_activefrom[<?=$i?>]",
button : "trigger",
ifFormat : "%d-%m-%Y",
daFormat : "%d-%m-%Y"
}
);
//]]></script>
</td>
<td align="center" valign="top">
<input name="rmrate_activeto[<?=$i?>]" type="text" id="rmrate_activeto[<?=$i?>]" size="10" maxlength="10" style="width: 68px;" />
<button id="trigger2">.</button>
<script type="text/javascript">//<![CDATA[
Zapatec.Calendar.setup(
{
firstDay : 1,
electric : false,
inputField : "rmrate_activeto[<?=$i?>]",
button : "trigger2",
ifFormat : "%d-%m-%Y",
daFormat : "%d-%m-%Y"
}
);
//]]></script>
</td>
<td align="center" valign="top">
<input name="room_isactive[<?=$i?>]" type="checkbox" id="room_isactive[<?=$i?>]" value="1" />
</td>
</tr>
<?
$nextId++;
}//end for
?>
</table>
?>
//fnadd_room.php
Code (PHP)
<?php
for($i=0; $i<count($room_isactive); $i++)
{
echo "room id = ".$rmm_id[$i];
echo "<br>";
echo "bed type id = ".$bedtype_id[$i];
echo "<br>";
echo "price = ".$rm_prices[$i];
echo "<br>";
echo "active from = ".$rmrate_activefrom[$i];
echo "<br>";
echo "active to = ".$rmrate_activeto[$i];
echo "<br>";
echo "<br><br>";
}
?>
ไม่ทราบต้องแก้ยังไงเหรอครับ...ขอบคุณ ครับ
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-04-22 00:18:24 |
By :
Red lable |
View :
858 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
//fnadd_room.php
foreach($room_isactive as $key => $val)
//for($i=0; $i<count($room_isactive); $i++)
{
echo "room id = ".$rmm_id[$key ];
echo "<br>";
echo "bed type id = ".$bedtype_id[$key ];
echo "<br>";
echo "price = ".$rm_prices[$key ];
echo "<br>";
echo "active from = ".$rmrate_activefrom[$key ];
echo "<br>";
echo "active to = ".$rmrate_activeto[$key ];
echo "<br>";
echo "<br><br>";
}
?>
|
 |
 |
 |
 |
Date :
2009-04-22 13:08:21 |
By :
lozomac |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากครับ คุณ a-mac
|
 |
 |
 |
 |
Date :
2009-04-22 13:37:32 |
By :
Red lable |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|