jay.barnes Posted August 8, 2009 Share Posted August 8, 2009 This may be a hybrid HTML/PHP/MySQL/Javascript(possibly even AJAX) question, so please forgive me if I exit the scope of this forum anywhere... SCENARIO: I have a browser window that has a dynamic table, showing the results of a MySQL query. On this page is a link that a user can click on that will pop-up a search window with a form on it that will allow him/her to search the DB by altering the parameters of the MySQL query in the original, parent window. (or at least that's what I'm hoping to make it do! ) My question is, how can I pass the form data from the pop-up window back to the parent window, so I can pass my new search parameters on the page? Additionally, after passing the form data back to the parent window, I'd have to reload the parent window, in order to apply the new search parameters, right? How would I go about telling the parent window to reload after "submit" is clicked on the pop-up window? Thanks for any suggestions you guys might be able to offer - I've just about run out of ideas! Quote Link to comment https://forums.phpfreaks.com/topic/169367-passing-form-data-between-windows/ Share on other sites More sharing options...
wildteen88 Posted August 8, 2009 Share Posted August 8, 2009 You wll need to use the target="_parent" attribute in your form tag. That way when you submit the form it sends the request to the parent window. Quote Link to comment https://forums.phpfreaks.com/topic/169367-passing-form-data-between-windows/#findComment-893676 Share on other sites More sharing options...
jay.barnes Posted August 8, 2009 Author Share Posted August 8, 2009 An additional thought while turning this over in my head - I think I figured out how to pass the form variables to the parent page - set the POST variables as SESSION variables.... Now I just have to figure out how to send a refresh/reload command to the parent window. Quote Link to comment https://forums.phpfreaks.com/topic/169367-passing-form-data-between-windows/#findComment-893677 Share on other sites More sharing options...
jay.barnes Posted August 8, 2009 Author Share Posted August 8, 2009 You wll need to use the target="_parent" attribute in your form tag. That way when you submit the form it sends the request to the parent window. You know? I knew about the "_parent" name, but I wasn't sure if, when you loaded a pop-up window, whether it would create a static, solid parent-child link between the two windows, or if it might lose the relation, and simply spawn a new window. Thanks for the suggestions! The experiments continue..... Quote Link to comment https://forums.phpfreaks.com/topic/169367-passing-form-data-between-windows/#findComment-893679 Share on other sites More sharing options...
infiniteacuity Posted August 10, 2009 Share Posted August 10, 2009 You can also use window.opener in JS, for example: <script language="javascript"> window.opener.location.href="inner.php?location_id=<?=$_REQUEST[location_id]?>&refresh=<?=$rand?>&category=<?=$_REQUEST[category]?>&page=<?=$_REQUEST ?>#anchor_<?=$_REQUEST[pid]?>"; </script> Quote Link to comment https://forums.phpfreaks.com/topic/169367-passing-form-data-between-windows/#findComment-894978 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.