|
 |
|
การส่งค่าจาก page หนึ่งไปอีก page หนึ่ง โดยส่งค่าให้ <select> แบบสองชั้น มันไม่รับค่าอ่ะครับ |
|
 |
|
|
 |
 |
|
page ส่ง
Code (JavaScript)
<script language="javascript">
function selValue()
{
//var val_owner_id,val_f = '';
//val_b = document.getElementById('txt_owner_id').value;
//val_f = eval("frm_use_this.numyear_f.value") + "-" + eval("frm_Popup.nummonth_f.value") + "-" + eval("frm_Popup.numdate_f.value");
window.opener.document.getElementById("txtcompaid").value = document.getElementById('txt_owner_id').value;
window.opener.document.getElementById("txtcompa").value = document.getElementById('txt_name_owner').value;
window.opener.document.getElementById("dll_typecom").value = document.getElementById('txt_id_type_owner').value;
window.opener.document.getElementById("txtleader").value = document.getElementById('txt_leader').value;
window.opener.document.getElementById("dll_amphoe").value = document.getElementById('txt_code_amphoe').value;
window.opener.document.getElementById("dll_tambon").value = document.getElementById('txt_code_tambon').value;
window.opener.document.getElementById("txtaddress").value = document.getElementById('txt_address').value;
window.opener.document.getElementById("txttel").value = document.getElementById('txt_telephone').value;
window.opener.document.getElementById("txtfax").value = document.getElementById('txt_fax').value;
window.opener.document.getElementById("txtemail").value = document.getElementById('txt_email').value;
window.close();
}
</script>
page รับ
ตรง ค่า dll_tambon
Code (PHP)
<script type="text/javascript">
function tambon(SelectValue)
{
frm_register.dll_tambon.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('- เลือกตำบล -','')
frm_register.dll_tambon.options[frm_register.dll_tambon.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM tambon ORDER BY code_tambon ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = <?=$objResult["code_amphoe"];?>;
strValue = "<?=$objResult["code_tambon"];?>";
strItem = "<?=$objResult["name_tambon"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frm_register.dll_tambon.options[frm_register.dll_tambon.length]= myOption
}
<?
}
?>
}
</script>
<form id="frm_register" name="frm_register" method="post" action="<?=$_SERVER[PHP_SELF];?>?selectyear=<?=$_REQUEST[selectyear];?>"
onsubmit="JavaScript:return fnc_register();">
<tr align="center" >
<td width="50%" valign="top">
<fieldset >
<br><u><div style="font-size:16px; text-align:left;">ข้อมูลผู้ประกอบการ</div></u><br>
<label class="label" for="txtcompaid">รหัสจดทะเบียน: </label>
<input class="input" name="txtcompaid" type="text" id="txtcompaid" maxlength="8" onKeyUp="IsNumeric(this.value,this)"/>
<a onclick="chk_sumits()" target="_blank">
<img src="../images/arrow.png" align="absbottom" width="25" height="25" border="0" title="เช็คข้อมูลเดิม" alt="เช็คข้อมูลเดิม" style="cursor:hand;"></a>
<br />
<label class="label" for="txtcompa">ชื่อกลุ่ม/บริษัท: </label>
<input class="input" name="txtcompa" type="text" id="txtcompa" />
<br />
<label class="label" for="txttpecom">เลือกประเภท: </label>
<select class="select" name="dll_typecom" id="dll_typecom">
<option selected value="">-- เลือกประเภท --</option>
<?
$strSQL = "SELECT * FROM type_owner ORDER BY id_type_owner ASC";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResult = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResult["id_type_owner"];?>">
<?=$objResult["type_owner"];?>
</option>
<?
}
?>
</select>
<br />
<label class="label" for="txtleader"> ชื่อเจ้าของ/ประธาน: </label>
<input class="input" name="txtleader" type="text" id="txtleader" />
</fieldset>
</td>
<td width="50%" valign="top">
<fieldset>
<br><u><div style="font-size:16px; text-align:left;">ที่อยู่/ที่ตั้ง</div></u><br>
<?
switch ($_SESSION["class_logoned"]){
case 2 :
?>
<label class="label" for="txtamphoe">อำเภอ: </label>
<select class="select" name="dll_amphoe" id="dll_amphoe" onchange = "tambon(this.value)">
<option selected value="">- เลือกอำเภอ -</option>
<?
$strSQL = "SELECT * FROM amphoe ORDER BY code_amphoe ASC";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResult = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResult["code_amphoe"];?>">
<?=$objResult["name_amphoe"];?>
</option>
<?
}
?>
</select>
<br />
<label class="label" for="txttambon">ตำบล: </label>
<select class="select" name="dll_tambon" id="dll_tambon">
<??>
<option>- เลือกตำบล -</option></select>
<br />
<?
break;
case 1 :
?>
<label class="label" for="txtamphoe">อำเภอ: </label>
<select class="select" name="dll_amphoe" id="dll_amphoe">
<option selected value="<?=$_SESSION[code_amphoe];?>"><?=$_SESSION[amphoe_logoned];?></option>
</select>
<br />
<label class="label" for="txttambon">ตำบล: </label>
<select class="select" name="dll_tambon" id="dll_tambon">
<option>- เลือกตำบล -</option>
<?
$strSQL = "SELECT * FROM tambon where code_amphoe = '$_SESSION[code_amphoe]' ORDER BY code_tambon ASC";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResult = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResult["code_tambon"];?>">
<?=$objResult["name_tambon"];?>
</option>
<?
}
?>
</select>
<br />
<?break;}?>
<label class="label" for="txtaddress">ที่อยู่: </label>
<textarea class="textarea" name="txtaddress" id="txtaddress" cols="45" rows="3"></textarea>
<br />
<label class="label" for="txttel"> เบอร์โทรศัพท์: </label>
<input name="txttel" type="text" class="input" id="txttel" onKeyUp="IsNumeric(this.value,this)" size="9" maxlength="9"/>
<BR>
<label class="label" for="txtfax"> เบอร์โทรสาร: </label>
<input name="txtfax" type="text" class="input" id="txtfax" onKeyUp="IsNumeric(this.value,this)" size="9" maxlength="9"/>
<BR>
<label class="label" for="txtemail"> E-MAIL: </label>
<input class="input" name="txtemail" type="text" id="txtemail" />
</center>
</fieldset>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="Submit" value="ลงทะเบียน" class="button" style="cursor:hand;"/></td>
</tr>
</form>
Tag : PHP, MySQL

|
ประวัติการแก้ไข 2011-06-20 09:56:48 2011-06-20 09:57:31
|
 |
 |
 |
 |
Date :
2011-06-20 09:55:05 |
By :
oasiis |
View :
1408 |
Reply :
9 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ช่วยดูหน่อยครับ
|
 |
 |
 |
 |
Date :
2011-06-20 10:41:37 |
By :
oasiis |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอดันกระทู้ขึ้นอีกหน่อยนะครับ
|
 |
 |
 |
 |
Date :
2011-06-20 12:18:07 |
By :
oasiis |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<select> ชั้นแรกมันรับ และแสดงค่าที่ได้มา จาเพจที่ส่งมาได้ แต่ <select> ชั้นที่ 2 มันไม่แสดงค่าที่ส่งมา
|
 |
 |
 |
 |
Date :
2011-06-20 13:20:01 |
By :
oasiis |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่มีใครช่วยแนะนำหรอครับ
|
 |
 |
 |
 |
Date :
2011-06-20 14:40:25 |
By :
oasiis |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอดันอีกครั้ง
ยังหาวิธีไม่เจอเลย
ช่วยแนะหน่อยครับ
|
 |
 |
 |
 |
Date :
2011-06-20 16:12:50 |
By :
oasiis |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอาแบบ select ธรรมดาได้ไหมแบบ listbox อะ
|
 |
 |
 |
 |
Date :
2011-06-20 16:55:13 |
By :
deedee2338 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลอง input ค่าไปไว้ใน hidden แล้วนำไปใช้ครับ
|
 |
 |
 |
 |
Date :
2011-06-21 09:20:52 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|