Vdaemon validation and my save to database code
I have a code that calls the VDend function of vdaemon in order to validate user input, after that i have a code that saves the contents of user input to database, however the code to save to database is executed irregardless of the results of VDend function of vdaemon. code looks similar to the one below, pls help me modify the code below so that code to save to database is only executed after all user inputs are already valid? thanks in advance!
include('vdaemon/vdaemon.php');
$fname = isset($_POST['fname']) ? trim(strip_tags($_POST['fname'])) : '';
$fname = preg_replace("/[\'\:\"]/", '', $fname);
$lname = isset($_POST['lname']) ? trim(strip_tags($_POST['lname'])) : '';
$lname = preg_replace("/[\'\:\"]/", '', $lname);
$school = isset($_POST['school']) ? trim(strip_tags($_POST['school'])) : '';
$school = preg_replace("/[\'\:\"]/", '', $school);
$username = isset($_POST['username']) ? trim(strip_tags($_POST['username'])) : '';
$username = preg_replace("/[\'\:\"]/", '', $username);
$passwd = isset($_POST['passwd']) ? trim(strip_tags($_POST['passwd'])) : '';
$passwd = preg_replace("/[\'\:\"]/", '', $passwd);
$confirm = isset($_POST['confirm']) ? trim(strip_tags($_POST['confirm'])) : '';
$confirm = preg_replace("/[\'\:\"]/", '', $confirm);
$email = isset($_POST['email']) ? trim(strip_tags($_POST['email'])) : '';
$email = preg_replace("/[\'\:\"]/", '', $email);
if (isset($_POST['submit']))
{
$vars = array('ACTION_PG' => append_sid($_SERVER['PHP_SELF']),
'MSG' => $msg
);
$template->set_file('registration', 'registration.htm');
$template->set_var('REGISTER', $vars);
$template->parse('registration');
VDEnd();
}
code to save to database is here-------------------
|