Yep. That was it. I totally missed that. 😃
The other error about $row went away.
In case another newbie wants to copy that script, it won't work unless you remove the line:
echo "Searching. Please wait."
Here's the working script if it helps someone...
<?php
#error_reporting(E_ALL); //ERROR REPORTING FOR DEBUGGING!!!
session_start(); // start session
if(!isset($_SESSION['insession'])) // if session is not set
header ('Location: sessionerr.php'); // kick 'em out to sessionerr.php
$stickernumber = $_POST["stickernumber"]; // get the value of stickernumber from the last page
include("dbconnect.php"); // connect to database
$sql="SELECT `recordtype` FROM `stickertable` WHERE `stickernumber` = $stickernumber"; // execute mysql query
$result=mysql_query($sql); // store query result into $result
$_SESSION['sessionstickernumber']="$stickernumber"; // store $stickernumber into session for passing to next page to search by...
if ($result && (mysql_num_rows($result)!= 0)) { // as long as something is found...
$row = mysql_fetch_array($result); // store it into $row
}
//now to redirect depending on the value of $recordtype...
switch($row['recordtype']) { // establish switch for multiple case scenario...
case 'child': // if value is 'child'
header("location:child.php"); // redirect here...
break;
case 'adult': // if value is 'adult'
header("location:adult.php"); // redirect here...
break;
case 'pet': // if value is 'pet'
header("location:pet.php"); // redirect here...
break;
default: // otherwise default to this...
printf("<br><br>Sorry. I can not find matching information in the database.<br>\n<a href='javascript:history.go(-1)'>back</a>");
}
include("dbclose.php"); // disconnect from database
?>
and to recall "sessionstickernumber" back on the next page:
<?php
#error_reporting(E_ALL); //ERROR REPORTING FOR DEBUGGING!!!
session_start(); // start session
if(!isset($_SESSION['insession'])) // if session is not set
header ('Location: sessionerr.php'); // kick 'em out to sessionerr.php
$stickernumber=$_SESSION['sessionstickernumber'];
echo "adultpage";
echo "<br>$stickernumber";
?>
HOORAY! IT WORKS!
Many thanks. 😃