Please can anybody help,
I have the following script that works on php 4.4.7 but not with 5.2.3.
it gives this error Notice: Undefined variable: submit
<form name="search" method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
Seach for: <input type="text" name="find" /> in
<Select NAME="field">
<Option VALUE="Ingredients">Ingredients</option>
<Option VALUE="Category">Category</option>
<Option VALUE="Title">Title</option>
</Select>
<input type="hidden" name="searching" value="yes" />
<input name="submit" type="submit" id="submit" value="submit" />
</form>
<?
if ($submit)
{
echo "<h2>Results</h2><p>";
if ($find == "")
{
echo "<p>You forgot to enter a search term";
exit;
}
include ('config.inc.php');
$find = strtoupper($find);
$find = strip_tags($find);
$find = trim ($find);
$data = mysql_query("SELECT * FROM $table WHERE upper($field) LIKE'%$find%'");
while($result = mysql_fetch_array( $data ))
{
extract($result);
echo"
<table width='780' border='0' cellspacing='2' cellpadding='0'>
</table>
";}
$anymatches=mysql_num_rows($data);
if ($anymatches == 0)
{
echo "Sorry, but we can not find an entry to match your query<br><br>";
}
echo "<b>Searched For:</b> " .$find;
}
?>
Please can anyone help its eating at my brainThis time it's about register_globals being off. $submit isn't set - $_POST['submit'] is. The same for other varibles from form.As such, you'll need to fix all of your scripts to use the appropriate superglobal arrays. More information about these variables can be found here: variables.predefined.Thank You I got it now
I have the following script that works on php 4.4.7 but not with 5.2.3.
it gives this error Notice: Undefined variable: submit
<form name="search" method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
Seach for: <input type="text" name="find" /> in
<Select NAME="field">
<Option VALUE="Ingredients">Ingredients</option>
<Option VALUE="Category">Category</option>
<Option VALUE="Title">Title</option>
</Select>
<input type="hidden" name="searching" value="yes" />
<input name="submit" type="submit" id="submit" value="submit" />
</form>
<?
if ($submit)
{
echo "<h2>Results</h2><p>";
if ($find == "")
{
echo "<p>You forgot to enter a search term";
exit;
}
include ('config.inc.php');
$find = strtoupper($find);
$find = strip_tags($find);
$find = trim ($find);
$data = mysql_query("SELECT * FROM $table WHERE upper($field) LIKE'%$find%'");
while($result = mysql_fetch_array( $data ))
{
extract($result);
echo"
<table width='780' border='0' cellspacing='2' cellpadding='0'>
</table>
";}
$anymatches=mysql_num_rows($data);
if ($anymatches == 0)
{
echo "Sorry, but we can not find an entry to match your query<br><br>";
}
echo "<b>Searched For:</b> " .$find;
}
?>
Please can anyone help its eating at my brainThis time it's about register_globals being off. $submit isn't set - $_POST['submit'] is. The same for other varibles from form.As such, you'll need to fix all of your scripts to use the appropriate superglobal arrays. More information about these variables can be found here: variables.predefined.Thank You I got it now