前端

img jxyuhua

PEAR/HTML/HTML_Form学习

发表于2004/10/25 10:04:00  869人阅读

HTML_Form类是一个快速生成FORM表单的类文件,它一般用于保持代码清洁的PHP文件中(避免过多的PHP代码和HTML代码交织在一起),不适用于对外观要求很高的页面。
用法:
<?php
require_once('HTML/Form.php'); 
$form = new HTML_Form($_SERVER['PHP_SELF'], 'post');
$form -> addText('name', 'Name', '' , 20);
$form -> addPassword('password', 'Password', '', 10);
$form -> addCheckbox('language[]', 'PHP', 'PHP');
$form -> addCheckbox('language[]', 'DELPHI', '');
$form -> addSelect('income', 'Income', array('<1000', '<2000'));
$form -> addTextarea('note', 'Description', '', 20, 15);
$form -> addRadio('gender', 'Gender', 'male');
$form -> addRadio('gender', 'Gender', 'female');
$form -> addHidden('id', '1001');
$form -> addSubmit('submit', 'Send');
$form -> addReset('Reset');
$form -> display();
?>
全部的函数列表如下:
----------------------------------------------------
function HTML_Form($action, $method = 'get', $name = '', $target = '', $enctype = '')
function addText($name, $title, $default = '',
function addPassword($name, $title, $default, $size = HTML_FORM_PASSWD_SIZE)
function addCheckbox($name, $title, $default)
function addTextarea($name, $title, $default,
function addSubmit($name = "submit", $title = "Submit Changes")
function addReset($title = "Discard Changes")
function addSelect($name, $title, $entries, $default = '', $size = 1,
function addRadio($name, $title, $value, $default = false)
function addImage($name, $src)
function addHidden($name, $value)
function addBlank($i,$title = '')
function addFile($name, $title, $maxsize = HTML_FORM_MAX_FILE_SIZE,
function start()
function end()
function displayText($name, $default = '',
function displayTextRow($name, $title, $default = '',
function displayPassword($name, $default = '', $size = HTML_FORM_PASSWD_SIZE)
function displayPasswordRow($name, $title, $default = '', $size = HTML_FORM_PASSWD_SIZE)
function displayCheckbox($name, $default = false)
function displayCheckboxRow($name, $title, $default = false)
function displayTextarea($name, $default = '', $width = 40,
function displayTextareaRow($name, $title, $default = '', $width = 40,
function displaySubmit($title = 'Submit Changes', $name = "submit")
function displaySubmitRow($name = "submit", $title = 'Submit Changes')
function displayReset($title = 'Clear contents')
function displayResetRow($title = 'Clear contents')
function displaySelect($name, $entries, $default = '', $size = 1,
function displaySelectRow($name, $title, &$entries, $default = '',
function displayHidden($name, $value)
function displayRadio($name, $value, $default = false)
function displayRadioRow($name, $title, $value, $default = false)
function displayBlank()
function displayBlankRow($i, $title= '')
function displayFile($name, $maxsize = HTML_FORM_MAX_FILE_SIZE,
function displayFileRow($name, $title, $maxsize = HTML_FORM_MAX_FILE_SIZE,
function returnText($name, $default = '', $size = HTML_FORM_TEXT_SIZE)
function returnTextRow($name, $title, $default = '', $size = HTML_FORM_TEXT_SIZE)
function returnPassword($name, $default = '', $size = HTML_FORM_PASSWD_SIZE)
function returnPasswordRow($name, $title, $default = '', $size = HTML_FORM_PASSWD_SIZE)
function returnCheckbox($name, $default = false)
function returnCheckboxRow($name, $title, $default = false)
function returnTextarea($name, $default = '', $width = 40, $height = 5)
function returnTextareaRow($name, $title, $default = '', $width = 40, $height = 5)
function returnSubmit($title = 'Submit Changes', $name = "submit")
function returnSubmitRow($name = "submit", $title = 'Submit Changes')
function returnReset($title = 'Clear contents')
function returnResetRow($title = 'Clear contents')
function returnSelect($name, $entries, $default = '', $size = 1,
function returnSelectRow($name, $title, &$entries, $default = '', $size = 1,
function returnHidden($name, $value)
function returnFile($name = 'userfile',
function returnMultipleFiles($name = 'userfile[]',
function returnStart($multipartformdata = false)
function returnEnd()
function display()
阅读全文
0 0

相关文章推荐

img
取 消
img