Question:

Ok i have a problem with my php script ...i need to pass an id ($id) to a page called page.php

by  |  earlier

0 LIKES UnLike

this page opens in a pop up where it fetches an image from the Database ...everything works perfect except for passing the id part..

i'm tired of trying and i kept 5 days googling but could not solve it !!

any help would be appreciated .. here's the line that drove me crazy

<A HREF='javascript:popup("page.php?id=$id"...

this $id was sent to this page by another page and now i want to resent it to some other page (page.php) i assumed it's already known for this page so i used it directly $id

 Tags:

   Report

3 ANSWERS


  1. If it is coming from another page you will need to set it again.

    For example if it is coming via POST then use:

    $id = $_POST[&#039;id&#039;];

    or if it is coming by GET use:

    $id = $_GET[&#039;id&#039;];

    Then use $id in the link for the pop-up


  2. You mean

    &lt;A HREF=&#039;javascript:popup(&quot;page.php?id=&lt;? echo $id; ?&gt;&quot;

    or better

    &lt;A HREF=&quot;page.php?id=&lt;? echo $id ?&gt;&quot;

    onClick=&quot;popup(this/.href);

    return false&quot;&gt;


  3. It could be worth your time looking at $GLOBALS

    try the following on your page

    print_r($GLOBALS);

    Will show you an array of all variables whatever there existing group

Question Stats

Latest activity: earlier.
This question has 3 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions