473,473 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

passing values from child pop up window to parent window

8 New Member
can anyone help me, i have a php form and i have a view form which contains data in a table from the database.
what i am trying to do is that when i click the "List of Checks button" beside the text box check no. a pop up window will be displayed containing the data from the database(somehow i already managed to do that)

what i can't do is that i want to pass the value of the selected check no to be passed to the parent form in the check no text box.

it will be like the values of the check no column can be clicked and when the user selects a particular check no it will be passed to the original form and the pop up window will be closed.

can anyone help me.

Expand|Select|Wrap|Line Numbers
  1. //this is my code for my form.php:
  2.  
  3. <html>
  4. <head> <title> </title>
  5. <script src="../javascript/list.js"> </script>
  6. </head>
  7. <body>
  8. <form action="" name="addcashadv" method="post">
  9.  
  10. <table class="mytable" align="center">
  11. <tr><th colspan="3"></th></tr>
  12.  
  13.     <h2 align="center"> Add Cash Advance </h2>
  14.     <tr>
  15.         <td>Check Number:</td>
  16.         <td>
  17.             <input type="text" name="chekno" value="" /> 
  18.             <input type="button" onClick="List()" value="List of Checks">
  19.         </td>
  20.     </tr>    
  21.  
  22.     <tr>
  23.         <td>Employee Id:</td>
  24.         <td>
  25.             <input type="text" name="empid" onClick="" value="" />
  26.         </td>
  27.     </tr>
  28.     <tr>
  29.         <td>Full Name:</td>
  30.         <td>
  31.             <input type="text" name="fullname" value="" />
  32.         </td>
  33.     </tr>
  34.     <tr>
  35.         <td>Travel Order No:</td>
  36.         <td>
  37.             <input type="text" name="travelorder_no" value="" />
  38.  
  39.  
  40.         </td>
  41.     </tr>
  42.  
  43.     <tr>
  44.         <td>Remarks:</td>
  45.         <td>
  46.             <textarea name="Cashadvremarks"></textarea>
  47.         </td>
  48.     </tr>
  49.  
  50.     <tr>
  51.         <td></td>
  52.         <td>
  53.             <input type="submit" name="Submit" value="Submit" /> <input type="reset" value="Reset">
  54.  
  55.         </td>
  56.     </tr>
  57.     </table>
  58.  
  59. </form>
  60. </body>
  61. </html>
  62.  
Expand|Select|Wrap|Line Numbers
  1. //this is my code for the viewchecks.php
  2.  
  3. <html>
  4. <head>
  5. <title></title>
  6. <link rel="stylesheet" a href="stylesheets/style.css" type="text/css"/> 
  7. </head>
  8. <body>
  9.  
  10.  
  11. <?php
  12.  
  13. include "classes/pgsql_db.class.php";
  14. include "classes/checks_class.php";
  15.  
  16. $conn = new pgsql_db();
  17. $checks = new checks($conn);
  18.  
  19.  
  20.  
  21.  
  22. $sort_select_array = array("Check No.", "Check Date", "Amount", "Payee");
  23.  
  24.  
  25.  
  26.  
  27. $cdata = $checks->getChecks(); # get_results
  28.  
  29.  
  30.  
  31. ?>
  32.  
  33. <h2>Checks</h2>
  34.  
  35.  
  36. <table id="checksTable" table border="1" cellpadding = "3" class="mytable_data">
  37. <?php include "layouts/table_header.php"; ?> 
  38.  
  39. <?php 
  40. if(!empty($cdata)){
  41. foreach($cdata as $data)
  42. {
  43. echo "
  44.  
  45. </tr>
  46. <td width='70'>".$data->checkno."</td>
  47. <td width='110'>".$data->checkdate."</td>
  48. <td width='100'>"."P ".$data->amount."</td>
  49. <td width='400'>".$data->payee."</td>
  50. </tr>";
  51. }else{
  52. echo "<p class='error italic'>There are no checks.</p>";
  53. }
  54.  
  55.  
  56. ?>
  57. </table>
  58.  
  59.  
  60. </body>
  61. </html>
  62.  

Expand|Select|Wrap|Line Numbers
  1. //and this is my code for my JavaScript for pop-up 
  2.  
  3. function List() {
  4.             window.open( "viewchecks.php", "myWindow", 
  5.             "status = 1, height = 600, width = 800, resizable = 0" )
  6.             }
  7.  
  8.  
can anybody pls help???i would really appreciate it.
Dec 5 '11 #1
3 9393
omerbutt
638 Contributor
hi use the following method which i know do far
main file which opens popup window
file name = main.html
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. <script type="text/javascript">
  7. function popup(b_id){
  8.                 window.open("popup.html","Popup","height=700,width=525,,scrollbars=yes,"+ 
  9.                         "directories=yes,location=yes,menubar=yes," + 
  10.                          "resizable=yes status=yes,history=yes top = 50 left = 100");
  11.             }
  12.  
  13. </script>
  14. </head>
  15.  
  16. <body>
  17. <a href="#." onclick="popup();">Popu up</a>
  18. <form name="myform" id="myform">
  19.     <input type="text" name="passed_value" id="passed_value" />
  20. </form>
  21. </body>
  22. </html>
  23.  
  24.  
code for popup window

file name = popup.html

Expand|Select|Wrap|Line Numbers
  1.  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. <script type="text/javascript">
  7. function closeit(val){
  8.     window.opener.document.forms['myform'].elements['passed_value'].value=val;
  9.     window.close(this);
  10. }
  11.  
  12. </script>
  13. </head>
  14.  
  15. <body>
  16. hi this is a popup screen please clik here to close<a href="#." onclick="closeit('5');">close</a>
  17. </body>
  18. </html>
  19.  
  20.  
hope it helps ,
regards,
Omer Aslam
Dec 5 '11 #2
jeddsal
8 New Member
thanks so much....i was really able to apply it to my code
Dec 6 '11 #3
omerbutt
638 Contributor
Hi jeddsal
i am glad that it solved your problem , please choose the right answer so that other might also have help
regards,
Omer Aslam
Dec 6 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Filiz Duman | last post by:
Hi, I am opening a pop up window (child) from a parent window. The Child window does show a table with multiple columns and rows, each showing a value, e.g. 9 or 10 or etc. I have the values as...
3
by: Sandfordc | last post by:
I was curious one day and started to explore the whole idea of a document opening a pop up and that pop up being able to send data, that was input by the user, back to the parent. Does anyone have...
2
by: louise raisbeck | last post by:
I want to open up a little window so the user can choose something. So I will use javascript window.open to open up another aspx. However when they close this i want to map some text box values on...
1
by: Asha | last post by:
hello, can i pass a value back to a parent window from a child window after it closes? if yes, how can that be done? thanks a million in advance for the reply.
1
by: Paul D. Fox | last post by:
I'm trying to launch a Child Window from a hyperlink on a Datagrid and have it recieve multiple values from the Parent Window. Upon recieving the values in the Child Window, I need to access them...
3
by: RobG | last post by:
In Firefox if an HTML page is not hosted inside a frame or iframe, the following return true: (window === window.self); (window === window.parent); But in IE they return false (using ==...
2
by: gsuns82 | last post by:
hi all, I got to reload parent window from its child window,i used the folloeing code opener.location.reload(); self.close(); in child window. Parent window gets...
1
by: mia888 | last post by:
Hi All Any help will be much appreciated... Not sure if this is possible but i'll ask the question anyway... I have a parent window which opens a child window. However, upon closing I would...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.