Re: [PLEASE HELP] Passing variable to new page.
| From: | Chris Knipe | Date: | Thu, 06 Jun 2002 18:50:02 +0000 |
| Subject: | Re: [PLEASE HELP] Passing variable to new page. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100994@lists.php.net to get a copy of this message | ||
> 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.