NYCPHP Meetup

NYPHP.org

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

Ariel Kulkin ariel.kulkin at gmail.com
Wed Nov 1 22:56:50 EST 2006


All,

I appreciate your responses, but for some reason Brian's suggestion (which
is the one I can most comfortably follow, given my knowledge) is not
working.

Brian suggested:
<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')"/>


But once I put any parameter after Referral.php, all I get is that the "The
Page cannot be found".

I even tried replacing the button for an image and also a text link... and I
can't seem to be able to use either, to open the window AND pass the user_id
parameter (which is, indeed, a php variable).

An example of the failed attempt using a text link:
Just FYI : rstuserdata is my recordset,
                us_user_id is the field that contains (for sure) the value
which user_id should take
                user_id is the parameter I want to pass..

<a href="#" onclick="MM_openBrWindow('/Pop%20Ups/Referrals.php?user_id=<?php
echo $row_rstuserdata['us_user_id'];
?>','Referrals','scrollbars=yes,resizable=yes,width=500,height=600')">USE
THIS TEXT AS LINK</a>

Any thoughts?  I know that, collectively, you've suggested other
alternatives... but given my limited skill, this one has a syntax I
understand, and I know where to put it, in the code...

Your advise will be greatly appreciated.

Thanks!

Ariel.

On 10/31/06, Brian Dailey <support at dailytechnology.net > wrote:
>
> ---------- 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
> >
> >
> >
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20061101/dd327332/attachment.html>


More information about the talk mailing list