4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Urgent - Can't check data supplied by a form (like password)
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
scifo
Junior WebHelper
Junior WebHelper


Joined: 27 Jul 2003
Posts: 4

PostPosted: Thu Aug 07, 2003 2:23 pm (14 years, 4 months ago) Reply with QuoteBack to Top

Code:
<?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";
}
OfflineView User's ProfileFind all posts by scifoSend Personal Message
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Thu Aug 07, 2003 3:08 pm (14 years, 4 months ago) Reply with QuoteBack to Top

I'm just wondering whether looking for matches against all of those fields is the best way to go. There seems a lot of room for error the user would have to type all those details in in exactly the same way as they were originally entered.

Also why do you need to insert the same data in to another table?

Sorry for the questions, just trying to understand what you are trying to achieve
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.057897 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme