NYCPHP Meetup

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

Brian Dailey support at dailytechnology.net
Tue Oct 31 06:08:52 EST 2006


---------- 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','scrollbars=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
>
>
>



More information about the talk mailing list