Jump to content

php and hyperlinks


dekonstruct

Recommended Posts

Hi, I was wondering how to go about setting variables within a hyperlink. Here's the php part of what I'm trying to do (forgive my clunky code):

[code]
$_SESSION['date'] = date('z');
$counter = 0;
$_SESSION['nav'] = "c";

switch($_SESSION['nav']){
  case b:
    echo "forward";
    $counter = $counter + 1;    break;
 
  case a:
    echo "backward";
    $counter = $counter - 1;
    break;
 
  default:
    echo "nowhere";
}

$_SESSION['dateprint'] = date('z') + $counter;

?>
[/code]

and I'm trying to set the $_SESSION['nav'] variable within a hyperlink, and I've tried a couple of different ways that don't work. examples:

[code]
<a href="index.php?nav=a;>
<a href="index.php?_SESSION[nav]=b;">
[/code]

any help would be greatly appreciated thanks!
Link to comment
https://forums.phpfreaks.com/topic/30434-php-and-hyperlinks/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.