On Thu, April 12, 2007 9:14 am, Dan Shirah wrote:
> I have a page that has several links that point to the same page.  I
> want to
> pass a variable to the linked page depending on which link the user
> clicks
> to only display a result set that is relevant to the link clicked.  I
> know
> clicking on a link does not submit the page, so there would not be a
> $_POST
> value assigned.   Is there a way to pass a hidden value through a link
> without requiring the submit?

It won't be "hidden", but you can do:
<a href="whatever.php?from=1">1</a>
<a href="whatever.php?from=2">2</a>
<a href="whatever.php?from=3">3</a>

In whatever.php, you'll know which link because of what's in
$_GET['from']:

$from = (int) $_GET['from'];
switch($from){
  case 1:
  case 2:
  case 3:
    echo "From link $from<br />\n";
  break;
  default:
    echo "From unknown link: $from<br />\n";
  break;
}

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to