posting hidden form data to a popup window

S

simora

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
 
E

Erwin Moller

simora said:
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
 
M

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.?

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

simora said:
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
 
E

Erwin Moller

ma said:
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
=============================================

simora said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top