mysql - validate values through database in PHP -
i trying figure out how validate submitted form values through database file located on local computer. database file contains 2 columns number , amount. both columns have value inside. possible select database file column using mysql select statement , validate submitted value form? if value exists in database files, display form. if doesn't exist, want display error message.
here code,
<?php $displayform = true; if(isset($_post['check'])){ $taxinvoice = $_post["taxinvoice"]; $amount = $_post["amount"]; $displayform = false; $db = dbase_open('c:\users\richmond\desktop\ctp.dbf',0); ($i = 1; $i < dbase_numrecords($db);$i++) { $row = dbase_get_record_with_names($db, $i); if (($row['number'] == $taxinvoice) && ($row['amount'] == $amount)) { ?> <form method="post" action="<?php echo $_post['action']; ?>"> <input name="auth_user" type="hidden"> <input name="auth_pass" type="hidden"> <input name="redirurl" type="hidden" value="<?php echo $_post['redirurl']; ?>"> <input name="accept" type="submit" value="continue"> </form> <?php } else { ?> <?php } } } if($displayform) { ?> <form method="post" action=""> <label>tax invoice:</label><br> <input type="text" name="taxinvoice"><br> <label>amount:</label><br> <input type="text" name="amount"><br> <input type="submit" name="check" value="check"> </form> <?php } ?>
Comments
Post a Comment