NYCPHP Meetup

[nycphp-talk] Passing parameters with the click of a button.

Cliff Hirsch cliff at pinestream.com
Tue Oct 31 08:38:57 EST 2006


If you don't need the initial server-side script to use the variable
until the form in the new window is submitted, you can also use
JavaScript to copy the variable from the old window into the new Window.
For example, you can copy it into a hidden input field.

-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of Brian Dailey
Sent: Tuesday, October 31, 2006 6:09 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Passing parameters with the click of a button.

---------- Forwarded message ----------
From: "Brian Dailey" <kungfoofool at gmail.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Date: Tue, 31 Oct 2006 06:08:13 -0500
Subject: Re: [nycphp-talk] Passing parameters with the click of a button.
Ariel,

Assuming user_id is a PHP variable, you should be able to do it like
this.

<input type="radio"  name="Referrals" value="Y"
onclick="MM_openBrWindow('/Pop%20Ups/Referrals.php?user_id=<?=$user_id?>
','Referrals','scrollbars=yes,resizable=yes,width=500,height=600')"/>
     Yes<br />

And in referrals.php...

<?
 $user_id = $_GET['user_id'];
?>

That's *one* way to do it. However, it's very insecure. If you're
setting variables like user_id they should never be accessible from a
GET param where the user can manipulate it directly. It would be best
to set user_id in a SESSION variable somewhere - then you can access
it from any page you want without having to worry about constantly
passing it as a parameter.

On 10/30/06, Ariel Kulkin <ariel.kulkin at gmail.com> wrote:
> Problem Statement: With the click of a button, I need to open a new
window
> (to capture "user referrals"), and pass to it a parameter that will be
used
> to track the user id of the individual who originated those referrals.
>
> I have no problems opening the window with the button click:
> I can't quite get the syntax, however, to pass the user_id
parameter...
> How do I go about passing the user_id parameter to the newly open
window?
>
> CODE:
>
> Do you know anybody who may benefit from using XYZ System?
>       <label>
>       <input name="Referrals" type="radio" value="N" checked="checked"
/>
>       No</label>
>       <label>
>       <input type="radio"  name="Referrals" value="Y"
>
onclick="MM_openBrWindow('/Pop%20Ups/Referrals.php','Referrals','scrollb
ars=yes,resizable=yes,width=500,height=600')"/>
>       Yes<br />
>
> Your assistance is appreciated.
>
> Thanks!
>
> Ariel.
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
>
>
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php




More information about the talk mailing list