View unanswered posts | View active topics It is currently Tue Nov 20, 2018 2:14 am



Reply to topic  [ 1 post ] 
 Cannot check data supplied by a from 
Author Message
Junior Member

Joined: Sun Aug 03, 2003 9:28 am
Posts: 3
Post 
I have a file which processes the data submitted by the form. I want to check whether the data submitted is identical to the data in mysql database so that if it is not the user corrects the form and submits it again. Here is the code which cannot check the data in submitted form:

<?php
global $HTTP_POST_VARS;
if (isset($HTTP_POST_VARS['mybutton'])) {
$Host = "***";
$DBName = "***";
$TableName = "patientsform";
$Link = mysql_connect ($Host, '***', '***');
if ($Link==false) {
echo mysql_errno().": ".mysql_error()."
\n";
}
mysql_select_db ($DBName, $Link);
$Query1 = "SELECT Forename FROM patients WHERE Forename = {$HTTP_POST_VARS['forename']} AND Surname = {$HTTP_POST_VARS['surname']}";
//The query to check the data submitted
$Query = "INSERT INTO $TableName VALUES ('0', '{$HTTP_POST_VARS['forename']}')";
//The query to put the submitted data into the table

if (mysql_query ($Query1, $Link)) {
print "The query1 was successfully executed!
\n";

if (mysql_query ($Query, $Link)) {
print "The query was successfully executed!
\n";
}
else {
print "The query could not be executed!
\n";
echo mysql_errno().": ".mysql_error()."
\n";
}

}
else {
print "The query1 could not be executed!
\n";
echo mysql_errno().": ".mysql_error()."
\n";
}

mysql_close($Link);
} //end of isset function

else {
echo "you must have come here from somewhere else.\n";
}


Wed Aug 06, 2003 7:49 am
Report this post
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
cron
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.