RE: [PHP] [PLEASE HELP] Passing variable to new page.
| From: | Scott Hurring | Date: | Thu, 06 Jun 2002 19:05:35 +0000 |
| Subject: | RE: [PHP] [PLEASE HELP] Passing variable to new page. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-101002@lists.php.net to get a copy of this message | ||
Javascript, being silly, has silly string rules:
function pop1($id) {
window.open("info.php?prod_id="+ $id);
}
---
Scott Hurring
Systems Programmer
EAC Corporation
ScottH@eac.com
Voice: 201-462-2149
Fax: 201-288-1515
> -----Original Message-----
> From: Chris Knipe [mailto:savage@savage.za.org]
> Sent: Thursday, June 06, 2002 2:50 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] [PLEASE HELP] Passing variable to new page.
>
>
> > echo "<script language=\"JavaScript\">";
> > echo" function pop1() {";
> > echo" window.open(\"info.php?prod_id=$result[0]\"); }"; \\
> $result[0] is
> > variable that stores id of the image in database
> > echo "</script>";
> >
> > I am calling this function in the following manner: echo"<img
> > onclick=\"pop1();\"";
> ^^^^^^^^^^^^^^^^^^^^^
>
> You're not passing a value to the variable. Try using
> something like: (i'm
> NO java guru, and this definately isn't the list for java)...
>
> function pop1($id) {
> window.open("info.php?prod_id=$id");
> }
>
> and
>
> <img src="blah" onclick="pop1(12345)">
>
> Where 12345 is the product ID that you assigned to variable
> prod_id, which
> will in return be displayed in the second PHP file. You're problem's
> related to the java script, not assigning the value to the
> variable. This
> isn't a PHP issue.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>