By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,678 Members | 1,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,678 IT Pros & Developers. It's quick & easy.

posting hidden form data to a popup window

P: n/a
Hi:
Need some working sample code to post hidden form data from a php page
to a new popup window. 540 x 500 centered. The popup that I'm calling
already is formatted and has a TITLE:web-2007.php so what I need to do
is to write the values from the PHP page to that popup in specific
places.

Some of the hidden values are also like this format;

<input type="hidden" name="handling" value="<?php echo $_POST["sub"];
?>">

<input type="hidden" name="email" value="<?php echo $_POST["email"];
?>">

Right now,the hidden input fields are on a PHP page, and I'm calling the
popup from the generated PHP page like so:

<A HREF="javascript:void(0);" style="TEXT-DECORATION: none"
onClick="popUpCenteredWindow();">&nbsp;<span style="color: blue; font-
family: Verdana;">&nbsp;Click Here &nbsp;&nbsp;</span></span></A></font>

<script language="JavaScript">

function popUpCenteredWindow() {
var iMyWidth;
var iMyHeight;
//gets top and left positions .
iMyWidth = (window.screen.width/2) - (200 + 10);
//half the screen width etc..
iMyHeight = (window.screen.height/2) - (255 + 1);
//half the screen height etc...
var win2 = window.open("web-2007.php","Window2","status,height=
540,width=500,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight +
",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");
win2.focus();
}
</script>

Need help. Thanks
May 26 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
simora wrote:
Hi:
Need some working sample code to post hidden form data from a php page
to a new popup window. 540 x 500 centered. The popup that I'm calling
already is formatted and has a TITLE:web-2007.php so what I need to do
is to write the values from the PHP page to that popup in specific
places.

Some of the hidden values are also like this format;

<input type="hidden" name="handling" value="<?php echo $_POST["sub"];
?>">

<input type="hidden" name="email" value="<?php echo $_POST["email"];
?>">

Right now,the hidden input fields are on a PHP page, and I'm calling the
popup from the generated PHP page like so:

<A HREF="javascript:void(0);" style="TEXT-DECORATION: none"
onClick="popUpCenteredWindow();">&nbsp;<span style="color: blue; font-
family: Verdana;">&nbsp;Click Here &nbsp;&nbsp;</span></span></A></font>

<script language="JavaScript">

function popUpCenteredWindow() {
var iMyWidth;
var iMyHeight;
//gets top and left positions .
iMyWidth = (window.screen.width/2) - (200 + 10);
//half the screen width etc..
iMyHeight = (window.screen.height/2) - (255 + 1);
//half the screen height etc...
var win2 = window.open("web-2007.php","Window2","status,height=
540,width=500,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight +
",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");
win2.focus();
}
</script>

Need help. Thanks
Hi,

This can be solved in different ways, depending on your needs/setup.
1) The easiest way is changing the url you use and expand it so it contains
(urlencoded) name/value pairs.
eg:

var theURL = "web-2007.php";
// get some hidden form info:
var firstname = document.forms.formnamehere.firstname.value;
theURL += "?firstname="+firstname;
theURL = encodeURI(theURL);

var win2 = window.open(theURL,"Window2","status,height=
540,width=500,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight +
",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");

Then from the popup, read the URL, and get your name-value pairs out.

2) More complex: Make window-communication.
EG: On the popupwindow add an onLoad-eventhandler that calls a function that
loads info from the opener.
eg:
<body onLoad="loadHiddenInfo();">
....
<script type="text/javascript">
function loadHiddenInfo(){
var firstname = opener.document.forms.formnamehere.firstname.value ;
alert (firstname);
}
</script>

3) Use a SUBMIT instead of a hyperlink. CHange the target of your form to
the name of the window you opened (it must be opened first by yourself if
you want to set dimension like width and height.).

Regards,
Erwin Moller
May 26 '07 #2

P: n/a
ma


Hi:

Thanks for the ideas, but I'm not well versed on the level of javascript
required. I'll need more sample code suited to my situation. On my
formatted PHP page, I'm set up to get vlues in this format;
<?php echo $_POST["salutation"]; ?>.&nbsp;
<?php echo $_POST["first_name"]; ?>&nbsp;<?php echo $_POST["last_name"];
?><BR>
&nbsp;<?php echo $_POST["address"]; ?><BR>

What I need to see is both how I can send the hidden values, and how do
I display them on the PHP popup page. I do not need an alert.

Is there some way to make sure that the popup is fully opened before I
start having it get the hidden values.?

=============================================

On Sat, 26 May 2007 03:14:38 -0700, Erwin Moller
<si******************************************@spam yourself.comwrote:
simora wrote:
>Hi:
Need some working sample code to post hidden form data from a php page
to a new popup window. 540 x 500 centered. The popup that I'm calling
already is formatted and has a TITLE:web-2007.php so what I need to do
is to write the values from the PHP page to that popup in specific
places.

Some of the hidden values are also like this format;

<input type="hidden" name="handling" value="<?php echo $_POST["sub"];
?>">

<input type="hidden" name="email" value="<?php echo $_POST["email"];
?>">

Right now,the hidden input fields are on a PHP page, and I'm calling the
popup from the generated PHP page like so:

<A HREF="javascript:void(0);" style="TEXT-DECORATION: none"
onClick="popUpCenteredWindow();">&nbsp;<span style="color: blue; font-
family: Verdana;">&nbsp;Click Here &nbsp;&nbsp;</span></span></A></font>

<script language="JavaScript">

function popUpCenteredWindow() {
var iMyWidth;
var iMyHeight;
//gets top and left positions .
iMyWidth = (window.screen.width/2) - (200 + 10);
//half the screen width etc..
iMyHeight = (window.screen.height/2) - (255 + 1);
//half the screen height etc...
var win2 = window.open("web-2007.php","Window2","status,height=
540,width=500,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight +
",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");
win2.focus();
}
</script>

Need help. Thanks

Hi,

This can be solved in different ways, depending on your needs/setup.
1) The easiest way is changing the url you use and expand it so it
contains
(urlencoded) name/value pairs.
eg:

var theURL = "web-2007.php";
// get some hidden form info:
var firstname = document.forms.formnamehere.firstname.value;
theURL += "?firstname="+firstname;
theURL = encodeURI(theURL);

var win2 = window.open(theURL,"Window2","status,height=
540,width=500,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight +
",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");

Then from the popup, read the URL, and get your name-value pairs out.

2) More complex: Make window-communication.
EG: On the popupwindow add an onLoad-eventhandler that calls a function
that
loads info from the opener.
eg:
<body onLoad="loadHiddenInfo();">
...
<script type="text/javascript">
function loadHiddenInfo(){
var firstname = opener.document.forms.formnamehere.firstname.value ;
alert (firstname);
}
</script>

3) Use a SUBMIT instead of a hyperlink. CHange the target of your formto
the name of the window you opened (it must be opened first by yourselfif
you want to set dimension like width and height.).

Regards,
Erwin Moller


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
May 26 '07 #3

P: n/a
ma <al.qwest.netwrote:
>

Hi:

Thanks for the ideas, but I'm not well versed on the level of javascript
required. I'll need more sample code suited to my situation. On my
formatted PHP page, I'm set up to get vlues in this format;
<?php echo $_POST["salutation"]; ?>.&nbsp;
<?php echo $_POST["first_name"]; ?>&nbsp;<?php echo $_POST["last_name"];
?><BR>
&nbsp;<?php echo $_POST["address"]; ?><BR>

What I need to see is both how I can send the hidden values, and how do
I display them on the PHP popup page. I do not need an alert.

Is there some way to make sure that the popup is fully opened before I
start having it get the hidden values.?
Hi,

I don't want to be rude: but I adressed those questions.
If you are not able to implement them, what do you want us to do?
Create the whole script without being able to see what you made already?

My suggestion: OR you learn a little JavaScript basics so you can implement
it yourself (it is really easy), OR you hire somebody who can help you with
it.
Sorry mate.

Regards,
Erwin Moller
>
=============================================

On Sat, 26 May 2007 03:14:38 -0700, Erwin Moller
<si******************************************@spam yourself.comwrote:
>simora wrote:
>>Hi:
Need some working sample code to post hidden form data from a php page
to a new popup window. 540 x 500 centered. The popup that I'm calling
already is formatted and has a TITLE:web-2007.php so what I need to do
is to write the values from the PHP page to that popup in specific
places.

Some of the hidden values are also like this format;

<input type="hidden" name="handling" value="<?php echo $_POST["sub"];
?>">

<input type="hidden" name="email" value="<?php echo $_POST["email"];
?>">

Right now,the hidden input fields are on a PHP page, and I'm calling the
popup from the generated PHP page like so:

<A HREF="javascript:void(0);" style="TEXT-DECORATION: none"
onClick="popUpCenteredWindow();">&nbsp;<span style="color: blue; font-
family: Verdana;">&nbsp;Click Here &nbsp;&nbsp;</span></span></A></font>

<script language="JavaScript">

function popUpCenteredWindow() {
var iMyWidth;
var iMyHeight;
//gets top and left positions .
iMyWidth = (window.screen.width/2) - (200 + 10);
//half the screen width etc..
iMyHeight = (window.screen.height/2) - (255 + 1);
//half the screen height etc...
var win2 = window.open("web-2007.php","Window2","status,height=
540,width=500,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight +
",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");
win2.focus();
}
</script>

Need help. Thanks

Hi,

This can be solved in different ways, depending on your needs/setup.
1) The easiest way is changing the url you use and expand it so it
contains
(urlencoded) name/value pairs.
eg:

var theURL = "web-2007.php";
// get some hidden form info:
var firstname = document.forms.formnamehere.firstname.value;
theURL += "?firstname="+firstname;
theURL = encodeURI(theURL);

var win2 = window.open(theURL,"Window2","status,height=
540,width=500,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight +
",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes");

Then from the popup, read the URL, and get your name-value pairs out.

2) More complex: Make window-communication.
EG: On the popupwindow add an onLoad-eventhandler that calls a function
that
loads info from the opener.
eg:
<body onLoad="loadHiddenInfo();">
...
<script type="text/javascript">
function loadHiddenInfo(){
var firstname = opener.document.forms.formnamehere.firstname.value ;
alert (firstname);
}
</script>

3) Use a SUBMIT instead of a hyperlink. CHange the target of your form to
the name of the window you opened (it must be opened first by yourself if
you want to set dimension like width and height.).

Regards,
Erwin Moller


May 28 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.