Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > Client Script Forum > สอบถาม การทำ popup คืนค่า จากหน้า popup หลัก พอทำเสร็จให้ปิดหน้าต่าง popup



 

สอบถาม การทำ popup คืนค่า จากหน้า popup หลัก พอทำเสร็จให้ปิดหน้าต่าง popup

 



Topic : 109824



โพสกระทู้ ( 16 )
บทความ ( 0 )



สถานะออฟไลน์




คือจะทำหน้า popup ให้เค้ากรอกจำนวน อุปกรณ์ ที่ต้องการ แล้วกด submit ในหน้า popup เพื่อไปอัพเดตข้อมูลคงเหลือปัจจุบัน ปัญหาคือ ตอนกด submit แล้ว ข้อมูลมันไม่ไปโชว์ในหน้าหลักให้ เหมือนมัน ไม่เรียกใช้ java script ให้

หน้าหลัก
page1.php

<script type="text/javascript">
		function popup(url,name,windowWidth,windowHeight){    
				myleft=(screen.width)?(screen.width-windowWidth)/2:100;	
				mytop=(screen.height)?(screen.height-windowHeight)/2:100;	
				properties = "width="+windowWidth+",height="+windowHeight;
				properties +=",scrollbars=yes, top="+mytop+",left="+myleft; 
				window.open(url,name,properties);
		}
</script>

<form  method="post" name="frmain">
	(1)
	<input type="text" name="tx1_1"  class="tx"  readonly>
    <input type="text" class="tx1" name="tx1_2"   readonly>
    <input type="text" class="tx" value="" name="tx1_3" size="5" readonly>
    <br>
    (2)
	<input type="text" name="tx2_1"  class="tx"  readonly>
    <input type="text" class="tx1" name="tx2_2"   readonly>
    <input type="text" class="tx" value="" name="tx2_3" size="5" readonly>
    <br>
    (3)
	<input type="text" name="tx3_1"  class="tx"  readonly>
    <input type="text" class="tx1" name="tx3_2"   readonly>
    <input type="text" class="tx" value="" name="tx3_3" size="5" readonly>
    <br>
    <a href="javascript:popup('popup_1.php','',505,500)" style="color:#000000"  class="bt1">กดเลือกอุปกรณ์ </a>
    
    
</form>





popup_1.php
<form method="post" name="ffrmain" action="popup_2.php" >	
		<?
				include("connect.php");
				$sql ="select * from device";
				$sqlQuery = mssql_query($sql); 
		?>
				<table border="1" cellspacing="0">
                	<tr bgcolor="#FFFFCC "id="table"> 
                		<th><center>รายการอุปกรณ์</center></th>
                		<th><center>จำนวนคงเหลือ</center></th>
                		<th><center>จำนวณที่ต้องการยืม</center></th>
                	</tr>
		<?	
				$i=1;
				while($data = mssql_fetch_array($sqlQuery)){
				
		?>
        		<tr>
                	<input type="hidden" value="<?=$data["id"]?>" name="id[]">
                	<td><center><input type="text" value="<? echo $data["Product_name"]?>" style="border:hidden" name="Product_name" readonly></center></td>
					<td><center><input type="text" value="<? echo $data["Product_stock"]?>" style="border:hidden" name="total_stock" readonly></center></td>
                    <td><input type="text" name="inputUnit[]" ></td>
             	</tr>
        <?
					$i++;
					
        			}
				echo "</table>";
				mssql_close();
				
		?>
        
        <center><input type="submit" value="ตกลง">
        <input type="button" value="ยกเลิก" name="cal" onClick="window.close();"></center>
     </form>   
  




popup_2.php
<script language="javascript">

	function updateOpener() {
				window.opener.document.frmain.txt1_1.value=document.farmain.pn[0].value;
				window.opener.document.frmain.txt2_1.value=document.farmain.pp[0].value;
				window.opener.document.frmain.txt3_1.value=document.farmain.ini[0].value;
				
				window.opener.document.frmain.txt1_2.value=document.farmain.pn[1].value;
				window.opener.document.frmain.txt2_2.value=document.farmain.pp[1].value;
				window.opener.document.frmain.txt3_2.value=document.farmain.ini[1].value;
				
				window.opener.document.frmain.txt1_3.value=document.farmain.pn[2].value;
				window.opener.document.frmain.txt2_3.value=document.farmain.pp[2].value;
				window.opener.document.frmain.txt3_3.value=document.farmain.ini[2].value;
				
				
				window.close();
	}
	

</script>

<form method="post" name="farmain">

<?
	include("connect.php");
	$sql_select_handset = "select * from device";
	$sql_queary_handset = mssql_query($sql_select_handset);
	$i=0;
	while($data_handset=mssql_fetch_array($sql_queary_handset)){
		if(!empty($_POST['inputUnit'][$i])){
?>
			<? $id=$data_handset['id'];?>
			<input type="hidden" name="pn[]" value="<?=$Product_name=($data_handset['Product_name']);?>"> 
            <input type="hidden" name="pp[]" value="<?=$Product_Price=($data_handset['Product_price']);?>">
			<? $Stock_borrow=($data_handset['Product_stock']);?>
			<input type="hidden" name="ini[]" value="<?=$inputUnit=($_POST['inputUnit'][$i]);?>" >
			<? $totalstock =$Stock_borrow-$inputUnit;?>
<?			
			$sql_update_handset ="update device set Product_stock='$totalstock' where id='$id'";
			$sql_quary_handset =mssql_query($sql_update_handset);
		}
		$i++;
	}

?>
<center><input type="submit" value="Close" onClick="Javascript:updateOpener()" ></center>
</form>



main

pop1

po



Tag : Ms SQL Server 2008







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2014-07-09 15:00:01 By : pongyakuza View : 1628 Reply : 1
 

 

No. 1



โพสกระทู้ ( 1,458 )
บทความ ( 0 )



สถานะออฟไลน์
Twitter Facebook Blogger

popup_1.php
<form method="post" name="ffrmain" action="page1.php" >	
		<?
				include("connect.php");
				$sql ="select * from device";
				$sqlQuery = mssql_query($sql); 
		?>
				<table border="1" cellspacing="0">
                	<tr bgcolor="#FFFFCC "id="table"> 
                		<th><center>รายการอุปกรณ์</center></th>
                		<th><center>จำนวนคงเหลือ</center></th>
                		<th><center>จำนวณที่ต้องการยืม</center></th>
                	</tr>
		<?	
				$i=1;
				while($data = mssql_fetch_array($sqlQuery)){
				
		?>
        		<tr>
                	<input type="hidden" value="<?=$data["id"]?>" name="id[]">
                	<td><center><input type="text" value="<? echo $data["Product_name"]?>" style="border:hidden" name="Product_name" readonly></center></td>
					<td><center><input type="text" value="<? echo $data["Product_stock"]?>" style="border:hidden" name="total_stock" readonly></center></td>
                    <td><input type="text" name="inputUnit" ></td>
             	</tr>
        <?
					$i++;
					
        			}
				echo "</table>";
				mssql_close();
				
		?>
        
        <center><input type="submit" value="ตกลง">
        <input type="button" value="ยกเลิก" name="cal" onClick="updateOpener();"></center>
     </form>   
  
<script language="javascript">

	function updateOpener() {
				window.opener.document.frmain.txt1_1.value=document.ffrmain.Product_name[0].value;
				window.opener.document.frmain.txt2_1.value=document.ffrmain.total_stock[0].value;
				window.opener.document.frmain.txt3_1.value=document.ffrmain.inputUnit[0].value;
				
				window.opener.document.frmain.txt1_2.value=document.ffrmain.Product_name[1].value;
				window.opener.document.frmain.txt2_2.value=document.ffrmain.total_stock[1].value;
				window.opener.document.frmain.txt3_2.value=document.ffrmain.inputUnit[1].value;
				
				window.opener.document.frmain.txt1_3.value=document.ffrmain.Product_name[2].value;
				window.opener.document.frmain.txt2_3.value=document.ffrmain.total_stock[2].value;
				window.opener.document.frmain.txt3_3.value=document.ffrmain.inputUnit[2].value;
				
				
				window.close();
	}
	

</script>


popup_2.php ไม่ต้องใช้






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2020-05-30 18:53:30 By : PhrayaDev
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สอบถาม การทำ popup คืนค่า จากหน้า popup หลัก พอทำเสร็จให้ปิดหน้าต่าง popup
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่