|
 |
|
อยากให้ส่งค่า popup มาอยู่ในตัวแปรเฉยๆ คือจะเก็บ ค่าเป็น session ในตัวอย่างมันคืนค่ามาใน textfield ครับ |
|
 |
|
|
 |
 |
|
อยากให้ส่งค่า popup มาอยู่ในตัวแปรเฉยๆ คือจะเก็บ ค่าเป็น session ในตัวอย่างมันคืนค่ามาใน
textfield ครับ
Code (PHP)
<html>
<head>
function OpenPopup(intLine)
{
window.open('seach_1.php?Line='+intLine,'myPopup','width=650,height=200,toolbar=0, menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=0,top=0');
}
</head>
<body>
<form action="" method="post">
<input id="name1" name="name1">
<input id="name2" name="nam2">
<INPUT TYPE="BUTTON" NAME="btnPopup_1" ID="btnPopup_1" VALUE="ค้น" OnClick="OpenPopup()">
</form>
</body>
<html>
หน้า popup
Code (PHP)
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>..</title>
</head>
<script language="javascript">
function selData(intLine,building_code,b_address)
{
var sbuilding_code = self.opener.document.getElementById("name1");
sbuilding_code.value = building_code;
var sb_address = self.opener.document.getElementById("name2");
sb_address.value = b_address;
window.close();
}
</script>
<body>
<form name="frmSearch" method="get" action="<?=$_SERVER['../SCRIPT_NAME'];?>">
<table width="599" border="1" cellpadding="0" cellspacing="0">
<tr>
<th>รหัสอาคาร & บ้้านเลขที่
<input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_GET["txtKeyword"];?>">
<input type="submit" value="Search"></th>
</tr>
</table>
</form>
<?
if($_GET["txtKeyword"] != "")
{
include('../libraly/config2.inc.php');
$strSQL = "SELECT * FROM building WHERE (building_code LIKE '%".$_GET["txtKeyword"]."%' or b_address LIKE '%".$_GET["txtKeyword"]."%' ) ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="600" border="1" cellpadding="0" cellspacing="0">
<tr>
<th width="91"> <div align="center">รหัสอาคาร </div></th>
<th width="98"> <div align="center">บ้านเลขที่</div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td>
<div align="center"><a href="#" OnClick="selData('<?=$_GET["Line"];?>' ,'<?=$objResult["building_code"];?>', '<?=$objResult["b_address"];?>' );">
<?=$objResult["building_code"];?>
</a></div>
</td>
<td><?=$objResult["b_address"];?></td>
</tr>
<?
}
?>
</table>
<?
mysql_close($objConnect);
}
?>
</body>
</html>
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2012-03-13 19:17:02 |
By :
praphat_thekop |
View :
1430 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ติดตรงไหนครับ ถ้าอยากเก็บลง Session ก็ Submit Form ใน popup แล้วค่อยจัดเก็บลงใน Session ครับ
|
 |
 |
 |
 |
Date :
2012-03-14 06:35:51 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ส่งค่าเก็บลงเซสชั่น คุณต้องลิ้งค์ไปหาไฟล์ที่เป็น .php แล้วส่ง Query String ไปด้วย แล้วให้มันเก็บลง Session ครับ แต่ในโค้ดที่ให้มาน่ะ มันเป็นการส่งกลับไปหา TextBox ของเพจที่ทำการเปิดป๊อบอัพนี้น่ะครับ
|
 |
 |
 |
 |
Date :
2012-03-14 11:06:41 |
By :
kenessar |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|