This is driving me nuts...!
I searched through the forums all morning to get down to this - no use....
I updated my php recently to 4.0.7RC3 (that zend thingy), I picked up some post here saying that update might be responsible for that?
I'm trying to pass some variable between scripts through html forms. So everytime the next script is called, it says my variable is undefined???? Scripts like that worked fine on my old machine (php4.0)...
Here's an example:
... a form ...
<form method="post" action="getit.php">
<select name="sort">
<option value="CoWorker">Co-Worker</option>
<option value="Charge">Charge</option>
<option value="Date">Date</option>
<option value="Project">Project</option>
<input type="submit" value="Go!">
</select>
</form>
... getit.php ....
// database connector //
include("connect.inc.php");
// html top //
include("top.inc.php");
$result = mssql_query("SELECT CoWorker, Charge, Date, Project, Descript, Hrs, HrsExt FROM CSFL WHERE tiltext = 5 ORDER BY $sort Desc");
if ($result){
$number = mssql_num_rows($result);
echo "<p>$number records found.</p>\n";
echo "<table border='1' bordercolor='#000000' cellspacing='0' cellpadding='5' width='100%' align='center'>\n";
echo "<tr><th>Date</th><th>Co-Worker</th><th>Charge</th><th>Project</th><th>Description</th><th>Hours</th><th>Ext</th></tr>\n";
while ($row = mssql_fetch_row($result)){
printf ("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",$row[2],$row[0],$row[1],$row[3],$row[4],$row[5],$row[6]);
}
echo "</table>";
}
mssql_close($connect);
// html bottom //
include ("bottom.inc.php");
...the error/warning I get ...
Warning: Undefined variable: sort in /usr/local/httpd/htdocs/mstest/rc1/getit.php on line 12
and of course the resulting database syntax errors...
I checked the variable passing with some simple scripts and checked the variables there with if(!isset($var1))... and this tells me the variables are.not.set.
It doesn't even recognize things like $PHP_SELF etc.
What did I do wrong?
Any Ideas?
Please?