Here is the code. The search page collects the infomation from the user and pass it to result_search_pat.php and from there it will generate results. This example only has two variables. Again my problem is that right now if I do a search on all records witht he last_name "smith" I would get no results because it is looking for last_name ="smith" OR id="null".
Thank you again for your time
search_pat.php:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<table width="800" border="1" align="center">
<tr>
<td><h2 align="center">Hello</h2></td>
</tr>
<tr>
<td><div align="center"></div>
<table width="180" border="0" align="center" cellpadding="0" cellspacing="2" bgcolor="#FFFFFF">
<form method="post" action="result_search_pat.php" name="log">
<tr>
<td>MRN</td>
<td><input size = "20" maxlength = "20" name = "id1" /></td>
</tr>
<tr>
<td>Last Name</td>
<td><input size = "15" maxlength = "20" name = "last_name" /></td>
</tr>
<tr>
<td colspan="2"><div align="center"><br />
<input type = "submit" name = "submit" value = "Enter"/>
</div></td>
</tr>
</form>
</table></td>
</tr>
</table>
</html>
result_search_pat.php:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$id1 = $POST["id1"];
$last_name = $POST["last_name"];
$first_name = $_POST["first_name"];
//connection with database
$link = mysql_connect("localhost", "user", "*****") or die("Could not connect <br>");
mysql_select_db("GammaDB") or die("Could not select database<br>");
$result = mysql_query("SELECT last_name, first_name, id1 FROM demographics_main WHERE last_name='$last_name' OR id1='$id1'");
if ($myrow = mysql_fetch_array($result)) {
echo "<table border=1>\n";
echo "<tr><td><h2>Last Name</h2></td><td><h2>First Name</h2></td><td><h2>MRN</h2></td></tr>\n";
do {
printf("<td>%s</td><td>%s</td><td>%s</td></tr>\n", $myrow["last_name"], $myrow["first_name"], $myrow["id1"]);
} while ($myrow = mysql_fetch_array($result));
echo "</table>\n";
} else {
echo "Sorry, no records were found!";
}
?>
</body>
</html>