加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

PHP自动生成表单代码分享

发布时间:2020-12-12 20:56:45 所属栏目:PHP教程 来源:网络整理
导读:Form.php action=$action; $this->method=$method; } function form_start(){ $text=" action}" method="{$this->method}""; if($this->class!==""){ $text.=" class="{$this->class}""; } if ($this->enctype!=="") { $text.=" enctype="{$this->enct

Form.php

action=$action; $this->method=$method; } function form_start(){ $text="
class!==""){ $text.=" class="{$this->class}""; } if ($this->enctype!=="") { $text.=" enctype="{$this->enctype}""; } if($this->id!==""){ $text.=" id="{$this->id}""; } if($this->name!==""){ $text.=" name="{$this->name}""; } $text.=">n"; if($this->layout==true){ $text.="layout==true) { $text="tform_label($label_name,$label_for); $form_item=$this->form_item($label,$text); return $form_item; } //密码框函数 function form_passwd($name,$value=""){ $text="form_label($label_name,$text); return $form_item; } //隐藏域函数 function form_hidden($name,$value=""){ $text="form_label($label_name,$text); return $form_item; } //文件域函数 function form_file($name,$size=""){ $text="form_label($label_name,$text); return $form_item; } //复选框函数 function form_checkbox($name,$label=array(),$label_for=""){ $i=0; $text=array(); foreach ($label as $id=>$value){ $text[$i]=""; $text[$i].="

使用示例:

用户登录 layout=false; //不使用表格布局,大家可以把这句注释掉看结果有何不同 $name=$form->form_text("userid","userid","用户名","userid"); $passwd=$form->form_passwd("passwd","passwd","密码","passwd"); $submit=$form->form_button("","submit","登录"); $form_item=array($name,$passwd,$submit); $form->CreateForm($form_item); ?>

以上所述就是本文的全部内容了,希望大家能够喜欢。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读