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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.