p469275 Posted January 21, 2008 Share Posted January 21, 2008 Hi Friends, Can anybody tell me please, How to Submit Variable Data from Pop Up to Main window (using PHP if needed)? I have a main.php page with a link Open_popup. Upon clicking the link a popup(popup.php) opens with a text box and a submit button. If I write something in textbox and press Submitbutton then the Popup window disappears and text value is returned to main.php Thanks. Regards, Sujoy Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted January 21, 2008 Share Posted January 21, 2008 try this: main.php <script language="javascript"> window.name="main"; function neWin() { window.open('popup.php','winPop','width=300,height=275'); // You can add more pop-up options as needed; I just included width and height for this example. } </script> <?php $info = $_POST['info']; if($info != NULL) { echo "$info"; echo "\n<br>\n<br>\n"; } ?> <a href="javascript:void(0)" onclick="neWin()">Start Form</a> popup.php <script language="javascript"> function yourfired() { setTimeout("window.close()", 50); } </script> <form action="main.php" target="main" method="post"> <input type="text" name="info"> <input type="button" value="Send" onclick="yourfired()"> </form> Quote Link to comment Share on other sites More sharing options...
p469275 Posted January 28, 2008 Author Share Posted January 28, 2008 Thanks...Superb and so simple code. Only one modification in it makes the code work. in popup.php <script language="javascript"> function yourfired() { setTimeout("window.close()", 50); } </script> <form action="main.php" target="main" method="post"> <input type="text" name="info"> <input type="submit" value="Send" onclick="yourfired()"> </form> 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.