Zebra_Form 是一个 PHP 类用于简化表单的创建和数据验证。示例代码:
03 | require 'path/to/Zebra_Form.php' ; |
06 | $form = new Zebra_Form( 'form' ); |
09 | $form ->add( 'label' , 'label_email' , 'email' , 'Email' ); |
14 | $obj = & $form ->add( 'text' , 'email' , '' , array ( 'autocomplete' => 'off' )); |
19 |
'required' => array ( 'error' , 'Email is required!' ), |
20 |
'email' => array ( 'error' , 'Email address seems to be invalid!' ), |
24 | $form ->add( 'label' , 'label_password' , 'password' , 'Password' ); |
25 | $obj = & $form ->add( 'password' , 'password' , '' , array ( 'autocomplete' => 'off' )); |
27 |
'required' => array ( 'error' , 'Password is required!' ), |
28 |
'length' => array (6, 10, 'error' , 'The password must have between 6 and 10 characters' ), |
32 | $form ->add( 'checkbox' , 'remember_me' , 'yes' ); |
33 | $form ->add( 'label' , 'label_remember_me_yes' , 'remember_me_yes' , 'Remember me' ); |
36 | $form ->add( 'submit' , 'btnsubmit' , 'Submit' ); |
39 | if ( $form ->validate()) { |
项目地址: