it is a search from mysql basic phone book tables
what im trying to do is submit the search then return the results on the same page Im having problmes passing the form imput to the mysql I keep geting undefined variable
the search part of the script works as a stand alone module
it wll take input from an outside html and send the results back to a new page I have changed some of the print statement to echo
Froggyman
Re: this is the errors that is now returns
changed to "POST"
Notice: Undefined variable: state in C:\WINDOWS\Desktop\phpA296.TMP on line 18
Notice: Undefined variable: city in C:\WINDOWS\Desktop\phpA296.TMP on line 19
state: City:
Notice: Undefined variable: state in C:\WINDOWS\Desktop\phpA296.TMP on line 42
Notice: Undefined variable: city in C:\WINDOWS\Desktop\phpA296.TMP on line 44
Fatal error: Maximum execution time of 30 seconds exceeded in C:\WINDOWS\Desktop\phpA296.TMP on line 52
how do I get it to print the form, wait for input, and then return the result it looks like it is trying to return the result before it has the question.
<html>
<head><title></title>
</head>
<body link="#000000" alink="#FF0000" vlink="#000000" bgcolor="#AAB5F6" topmargin="0">
<table border="0" width="800" cellspacing="0" cellpadding="0">
<tr>
<td>
<?php
$form_block = "<form method=\"POST\" action=\"$_SERVER[PHP_SELF]\">
<div align=center>
<table border=0 cellpadding=3 cellspacing=0 width=361>
<tr align=center>
<td bgcolor=#FFFFFF width=353>
<div align=center>
<p>state:<input type=\"text\" name=\"state\" value=\"$state[state]\" size=2 maxlength=2>\n
<b>City:</b><input type=\"text\" name=\"city\" value=\"$city[city]\" size=25 maxlength=25>
</div>
</td>
</tr>
<tr align=center>
<td bgcolor=#FFFFFF width=353>
<div align=center>
<p><font face=Arial><input type=\"submit\" name=\"submit\"></font>
</div>
</td>
</tr>
</table>
</div>
</form>
<p></td>
</tr>
</table>
</center>
</div/>";
{
echo "$form_block";
}
if ($state == "")
{$state = '%';}
if ($city == "")
{$city = '%';}
include("dbinfo.php");
$result = mysql_query ("SELECT * FROM access
WHERE state LIKE '$state%'
AND city LIKE '$city%'
");
if ($row = mysql_fetch_array($result)){
do {
echo $row["state"];
echo (" ");
echo $row["city"];
echo ("<p>");
} while($row = mysql_fetch_array($result));
} else {echo "Sorry, no records were found!";}
?>
</body>
</html>