Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

fValidation Help

posted by wayneman 7 years ago

Hi everyone,

I am new to Flourish and have been encouraged to give it a go for my project. Reading over the documentation I can see how it certainly speeds things up. I am having some trouble understanding where some code should go tho. I have this form...

#!text/html
<form action="register.php" method="post">
	<input type="text" name="fullname" size="40" /> : Name (full)<br /><br />
	<input type="email" name="email" size="40" /> : E-Mail Address<br /><br />
	<input type="text" name="user" size="40" /> : Choose a Username<br /><br />
	<input type="password" name="pass" size="40" /> : Choose a Password <br /><br />
	
	<input type="submit" name="register" value="register" /> 
	</form>

I want to use the fValidation to validate this form before I move on to add its contents to a database.

Do I need to add the fvalidation code on the same page as the form or on the start of the register.PHP page the form is sent to?

This is the flourish code I understand should perform the validation.

$validator = new fValidation();
    
    $validator->addRequiredFields('fullname');
    $validator->addRequiredFields('user');
    $validator->addRequiredFields('pass'); 
    $validator->addRequiredFields('email');
    $validator->addEmailFields('email');
   
 
    $validator->validate();

Thanks for any help and sorry if its a silly question I would just really like to get into this library.

I was able to get it working correctly after inserting it first in the page the form was sent to

posted by wayneman 7 years ago