Jump to content

To send the form values of a child window to a parent window


rekha

Recommended Posts

Hi

 

I have a main form with a hidden variable in a parent php page.When i click a link in this page a popup window opens.In that popup window I have a form and the form action is self page.I have posted the form variables and stored it in php variables in the child form.I had set the value for the hidden variable of the parent page as an array of posted values in the child window using javascript.

 

Now If i submit the child form by clicking the submit button the values are not assigned to the hidden field of the parent page.If i click the submit form twice the values are assigned to the hidden variable.

I want the child form to submit only once and the values are set to the hidden field of the parent page when the child form submit button is clicked only once.How can i do this?

 

Pls help.........

 

 

Regards

Rekha

http://hiox.org

Link to comment
Share on other sites

Hi

 

I have a form in parent php page

 

<form name=add>
<input type=hidden name=cus>
</form>

 

In child window i have a form like this

<form name=sub method=post action="<?php echo $PHP_SELF;?>" onsubmit="jss()">
<input type=text name=ss>
<input type=text name=cc>
<input type=submit value=run>
</form>
I have posted the values and stored it in a array as follows
$ss=$_POST['ss'];
$cc=$_POST['cc'];
$array=array($ss,$cc);

 

I used javascript function to set the array values to the hidden field in parent window.

function jss()
{
window.opener.document.add.cus.value="<?php echo base64_encode(serialize($array));?>";
}

 

When i post the values of hidden field in parent window

$arr=unserialize(base64_decode($_POST['cus']));

 

The values are assigned when i click the submit button of the child window twice.I want to set the values when submit button is clicked only once.

 

Pls help........

 

Regards

Rekha

 

 

 

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.