Lodius2000 Posted October 8, 2008 Share Posted October 8, 2008 first let me say, I know very little about javascript, i work in php. regardless I have a popup with a file upload on it, when the file is uploaded it performs a mysql query which generates a sequential id number for that file, I would like to transfer that id number to a text field on the parent window and then add a comma after the image,(so i want the text field to look like: 1,2,3,4,5 ... but have no idea how. a few things that I think would be needed are this, the ID number on the popup is a php variable called $img_id, the form on the parent page's form is called 'entry' and the text field that $img_id would go to is called 'images' thanks for any help you can provide Quote Link to comment Share on other sites More sharing options...
exally Posted October 8, 2008 Share Posted October 8, 2008 i am unsure if this works in your situation, but you could try parent.<function>. example: in the pop-up call a function in the parent window by going <script> parent.callFunction(var1, var2, ....); </script> and obviously that function will have to exist in the parent. When calling the popup you might have to give it a parent id (not 100% sure as i said) Quote Link to comment Share on other sites More sharing options...
Maq Posted October 8, 2008 Share Posted October 8, 2008 Create a separate page with your parameter and put it for the value of your text field, ex: Then call a separate function with javascript that creates a pop up window with that page and $_GET the vars via HTTP. There are plenty of examples online but you should pass it like this: $url = "../page_to_call?img_id=". $img_id . ""; Sorry if my code is messy I did this quickly, but I hope it helps you. Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 8, 2008 Share Posted October 8, 2008 Pop up page: ... <script type="text/javascript"> var ids = window.opener.getElementById('ids').value; if (ids.length==0){ ids = '<?php echo $img_id; ?>'; } else{ ids = ids+',<?php echo $img_id; ?>'; } window.opener.getElementById('ids').value = ids; </script> ... Parent page: ... <input type="text" name="images" id="ids" value=""> ... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.