I have tried to run the query using the advise so far given – unfortunately all that I managed to return was a list of all first names, not just those stipulated in the query.
It is possible that being new to FORMS I have not set the query up correctly & would be grateful if someone could run over it for me.
Thank you again for any assistance.
The URL for the query page is http://www.jdwyer.plus.com/input.html
INPUT FORM
<html>
<head>
<title>INPUT TEST
</title>
</head>
<body>
<form action="http://cgi.jdwyer.plus.com/cgi-bin/inputpro.php" method="GET" name="myform">
<input type="Text" name="thebox" align="TOP" size="25"><br>
<input type="Submit" value="Make Query" align="MIDDLE">
</body>
</html>
SQL/PHP QUERY CODE
#!/usr/local/bin/php4
<html>
<body>
<?php
$link = mysql_pconnect ("**", "", "******")
or die ("Could not connect");
mysql_select_db ("***")
or die ("Could not select database");
$search = $_POST['thebox'];
$query = "SELECT first_name FROM president WHERE state LIKE '%$search%'";
$result = mysql_query ($query)
or die ("Query failed");
echo "<table ALIGN=center border=10>\n";
echo "<tr><td BGCOLOR='#FFC6A5'>Name</td></tr>\n";
while ($myrow = mysql_fetch_array ($result)) {
printf("<tr><td>%s</td><td>\n",
$myrow[first_name]);
}
echo "</table>\n";
?>
</body>
</html>