Hi. In my example below, the session portion is working except it prints "yesyes" instead of just "yes." Why is it sending the value twice?
The page that starts it...
<?
session_start(); //start session
echo "
<head>
<link rel=\"stylesheet\" href=\"main.css\">
<title>Vortus Time Entry</title></head>";
$DBHost = "localhost";
$DBUser = "xxxx";
$DBPass = "xxxxxx";
$DBSelect = "xxxxxx";
$connection = mysql_connect("$DBHost","$DBUser","$DBPass");
mysql_select_db($DBSelect, $connection) or die ("Unable to access database.");
switch($btnSubmit) {
case "Submit":
echo "<form method=post ACTION=\"$PHP_SELF\">";
echo "<input type=\"hidden\" name=\"username\" value=\"$username\">\n";
$sql= "SELECT userName, userPassword from userLoginTable where userName='$username' AND userPassword='$password'";
$result = mysql_query($sql) or die ("Unable to query.");
echo "</form>";
if (mysql_num_rows($result) == 1){ echo "Good.";
session_register($valid); //register the variable
$valid="yes";
echo "<a href=saLaunch.php>Go here</a>";
die();
}
else {echo "Something's wrong...";}
}
A portion of saLaunch.php
<?
session_start(); //start the session
session_register("valid"); //start the session
echo "
<head>
<link rel=\"stylesheet\" href=\"main.css\">
<title>Vortus Time Entry</title>
</head>";
$DBHost = "localhost";
$DBUser = "xxxxx";
$DBPass = "xxxxxx";
$DBSelect = "xxxxxxxx";
$connection = mysql_connect("$DBHost","$DBUser","$DBPass");
mysql_select_db($DBSelect, $connection) or die ("Unable to access database.");
print $valid;
echo "$valid <-------hello!";
?>