Zebra_Form PHP的表单类

程序名称:Zebra_Form

授权协议: LGPL

操作系统: 跨平台

开发语言: PHP

Zebra_Form 介绍

Zebra_Form 是一个 PHP 类用于简化表单的创建和数据验证。

示例代码:

<?php
// include the Zebra_Form class
require 'path/to/Zebra_Form.php';

// instantiate a Zebra_Form object
$form = new Zebra_Form('form');

// the label for the "email" field
$form->add('label', 'label_email', 'email', 'Email');

// add the "email" field
// the "&" symbol is there so that $obj will be a reference to the object in PHP 4
// for PHP 5+ there is no need for it
$obj = & $form->add('text', 'email', '', array('autocomplete' => 'off'));

// set rules
$obj->set_rule(array(
    // error messages will be sent to a variable called "error", usable in custom templates
    'required'  =>  array('error', 'Email is required!'),
    'email'     =>  array('error', 'Email address seems to be invalid!'),
));

// "password"
$form->add('label', 'label_password', 'password', 'Password');
$obj = & $form->add('password', 'password', '', array('autocomplete' => 'off'));
$obj->set_rule(array(
    'required'  => array('error', 'Password is required!'),
    'length'    => array(6, 10, 'error', 'The password must have between 6 and 10 characters'),
));

// "remember me"
$form->add('checkbox', 'remember_me', 'yes');
$form->add('label', 'label_remember_me_yes', 'remember_me_yes', 'Remember me');

// "submit"
$form->add('submit', 'btnsubmit', 'Submit');

// validate the form
if ($form->validate()) {
    // do stuff here
}
// auto generate output, labels above form elements
$form->render();
?>

Zebra_Form 官网

http://stefangabos.ro/php-libraries/zebra-form/

相关编程语言

MuPlayer 是一款跨平台、轻量级的音频播放解决方案,...
OS FLV 是一个 开源和可嵌入网页的flv播放器。 这个...
DewPlayer音乐播放器,样式很简单,而且很实用.播放器...
JW FLV MEDIA PLAYER是一个开源的在网页上使用的Fla...
Speakker 是一个基于 Web 浏览器的音乐播放器,只提...
Player Framework 是一个开源的支持 HTML5 的视频播...