Jump to content

Submiting Variable Data from Pop Up to Main window (using PHP if needed)?


p469275

How to Submit Variable Data from Pop Up to Main window using PHP?  

3 members have voted

  1. 1. How to Submit Variable Data from Pop Up to Main window using PHP?

    • JavaScript
      1
    • PHP
      2


Recommended Posts

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

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>

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>

 

 

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.