OK I decided on breaking the ice and trying sessions. Now cool I got it to pass a var across the pages but what if I want to alter this var and then pass it...don't I have to keep $session_var = "my_var" right below session_start(); ? For example:
<PRE>
<?php
//globals.php
session_start();
$sess_var = "tableChoice"; <---i want this to pass $tableName to next page?
session_register("sess_var");
$hostName = "xxxxx"; // Where MySQL is running.
$userName = "xxxx"; // user name needed to connect.
$password = "xxxx"; // password for MySQL authentication.
$databaseName = "xxxxx"; // database name.
switch ($tableChoice) {
case "c":
$tableName="MyTable";
break;
case "r":
$tableName="YourTable";
break;
case "s":
$tableName="OurTable";
break;
default:
$tableName="none";
break;
}
?>
</PRE>
Now in my next page I use:
<PRE>
<?php
session_start();
$selectStmt = "SELECT * FROM $sess_var WHERE ROWID=$rowid " ;
.
.
.
.
?>
</PRE>
Obviously this isn't working and I know it's because I'm not directly passing the
variable tableName...through tableChoice....what I think I need to do is...
<PRE>
session_start();
$sess_var = switch ("tableChoice") {
case "c":
$tableName="MyTable";
break;
case "r":
$tableName="YourTable";
break;
case "s":
$tableName="OurTable";
break;
default:
$tableName="none";
break;
}
session_register("sess_var");
$hostName = "xxxxx"; // Where MySQL is running.
$userName = "xxxx"; // user name needed to connect.
$password = "xxxx"; // password for MySQL authentication.
$databaseName = "xxxxx"; // database name.
?>
</PRE>
...but this don't work....so I'm missing some understanding here, what do I do? Thanks again in advance,
Marcel.