You cannot access $_POST['startdate'] in action2.php . Its only available in action.php since it is posted from form.php to action.php . In order to make it available in action2.php (which is a hyperlink), you have to pass it in the query string like this.
echo "<a href=action2.php?startdate=".$_POST['startdate'].">Click here to go to action2.php </a>";
//You can then access startdate in action2.php as $_GET['startdate']
If you don't want to pass it in the query string, you can use sessions (But I think using sessions only for this particular variable is useless).
nav33n
Purple hazed!
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
Or if you don't like the ugly url when using hyperlinks then use sessions. To convert $_POST to $_SESSION simply use the following at the very top of your action.php page:
<?
session_start();
foreach($_POST AS $key => $val) {
$_SESSION[$key]=$val;
}
unset($key);
unset($val);
Then on every page that uses sessions, you need to place session_start(); on the second line with no output before it. And to retrieve a session use the following.
<?
session_start();
//post variable was $_POST['name']
echo $_SESSION['name'];
//post variable was $_POST['age']
echo $_SESSION['age'];
cwarn23
Occupation: Genius
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259