<?php global $HTTP_POST_VARS; if (isset($HTTP_POST_VARS['mybutton'])) {
$Link = mysql_connect (“localhost”, '', '');
mysql_select_db (“database”, $Link);
$query_to_check = "SELECT Forename,Surname,Address,Postcode,Doctor FROM patients WHERE
Forename = '$HTTP_POST_VARS[forename]' AND
Surname = '$HTTP_POST_VARS[surname]' AND
Address = '$HTTP_POST_VARS[address]' AND
Postcode = '$HTTP_POST_VARS[postcode]' AND
Doctor = '$HTTP_POST_VARS[doctornames]'";
/ Above I am checking whether data supplied by the form is identical to data in mysql database. Then if $query_to_check brings a result I want to add the data submitted by the form to another table. Here, I have to insert a function which lets the next function to execute if the supplied data is true. It is like username and password checking. Could you help me?
/
$Result = mysql_query ($query_to_check, $Link);
if ($Result) {
print "The query1 was successfully executed!<BR>\n";
print "
<table border=\"1\"><tr><th>Forename</th><th>Surname</th>
<th>Address</th><th>Postcode</th><th>Doctor</th></tr>";
for ($i=0; $i<mysql_num_rows($Result); $i++) {
$row = mysql_fetch_assoc($Result);
print "<tr>";
print "<td>".$row['Forename']."</td>";
print "<td>".$row['Surname']."</td>";
print "<td>".$row['Address']."</td>";
print "<td>".$row['Postcode']."</td>";
print "<td>".$row['Doctor']."</td>";
print "</tr>";
}
print "</table><br><br>\n";
} // end of if ($Result)
else {
print "The query1 could not be executed!<BR>\n";
echo mysql_errno().": ".mysql_error()."<BR>\n";
}
mysql_close($Link);
} // end of if (isset)
else {
echo "you must have come here from somewhere else.\n";
}