Please delete me
Please delete me

Reputation:

Passing a link value to other page

I have a page where it will retrieve a value from db a display in a page as link.

When i click this link that value should go to next page.

Note: It will have n values in a page so when i click a specific one, iit should only get that value a display in a new page.

Next page script

But i m not getting any values.

Any help will be appreciated.

Upvotes: 0

Views: 1878

Answers (1)

DreamWave
DreamWave

Reputation: 1940

Add a parameter to the link to the next page. If the next page is http://google.com open the link as http://google.com?link=http://something.com. Then on the next page get the value by $value=$_GET['link'];

Example:

echo '<a href="$thelink?link="'.$thelink.'">'.$link.'</a>';

And on the next page:

$thelink=$_GET['link'];

But since (if I understand you right) the opened link is the same as the one that is being passed.. you can simly get the link in the next page vie something like:

    <?php
    function curPageURL() {
     $pageURL = 'http';
     if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
     $pageURL .= "://";
     if ($_SERVER["SERVER_PORT"] != "80") {
      $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
     } else {
      $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
     }
     return $pageURL;
    }
    ?>
$thelink=curPageURL();

Upvotes: 1

Related Questions