Jump to content

How To Open A Popup Window In Php Code?


jrod356a

Recommended Posts

Hi all,I'm a PHP "Newbie" and am having trouble figuring out how to do the following:I have a page with a form that contains radio buttons for each option available to the user to submit via a submit button. The "form action" for the form is set to call a php script file (rpt_rdo_sel.php) when the submit button is clicked. I am trying to have a popup window opened when the user selects one of a particular set of radio buttons (any of the last 3 radio buttons on the form). The popup window is supposed to open and load an existing page located in my site's "dev/" directory. Through my research on the web, I found sample code to do this as follows:I made these entries in the rpt_rdo_sel.php file that is called when the submit button is clicked:Add the javascript code before the "<?php" or after the "?>" tags (I chose to put it before):<script type="javascript">function openRequestedPopup(){ window.open('http://www.usedcarinteriors.com/dev/finadminlogin.php', 'FinanceAdminReportsLogin', 'width=545,height=326,resizable=yes,scrollbars=yes,status=yes');}</script>Then add the following code within the PHP tags:echo "<script type='javascript'>openRequestedPopup();</script>";I then tested this by opening the form page in a browser window, I clicked one of the radio buttons that I designated for this function and clicked the submit button. I then got a blank page and the popup window I expected did not open. No errors were displayed on the resulting page however, I have FirePHP (a debugger tool) installed (I performed the test with FireFox) and I checked the output under the "Net" tab. The "Post" values were correctly passed but the "Response" values reported show the javascript code and the php "echo" code I added in the .php file. Now I'm not sure if my assumption is correct but I'm thinking that code may have been treated as comments text instead of program instructions and this is why all I'm getting is a blank page result?Can anyone help me to get this working like I want it to?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...