How to quickly generate a modern form form in PHP

Source: Internet
Author: User
Tags php form php form builder
This article mainly introduces the rapid generation of the PHP form form of the method, has a certain reference value, now share to everyone, the need for friends can refer to

Form-builder

PHP form builder, using PHP to quickly create a modern form form, including check boxes, radio boxes, input boxes, drop-down selection boxes and other elements, as well as the provincial city level three linkage, time selection, date selection, color selection, file/image upload and other functions.

GitHub Address | Composer Address

Forms are generated using the Form-create JS form Builder

If you are helpful, you can click "Star" in the upper right corner to support thank you!

This project is also in the continuous development and improvement, if there are suggestions or questions, please present here

Installation

composer require xaboy/form-builder

Example

Individual component Configuration Properties click to view

Please config/config.php configure the formSuccessScript properties in. Set the JS code or JS address after the form is submitted successfully, re- window.formCreate.formSuccess method (with <script> label) or modify directlyformScript.php

Namespace Test;use formbuilder\form;//input Component $input = form::input (' goods_name ', ' commodity name ');//Date Range Select Component $daterange = Form:: DateRange (    ' limit_time ',    ' interval date ',    strtotime ('-ten day '), Time    ());//provincial level two linkage $cityarea = form::city (' Address ', ' delivery addresses ', [    ' Shaanxi province ', ' Xian City ']);//Create form$form = Form::create ('/save.php ', [    $input, $dateRange, $cityArea]) ; $html = $form->setmethod (' Get ')->settitle (' Edit goods ')->view ();//Output Form page echo $html;

Component

namespace \FormBuilder\Form

  • Form::cascader Three-level linkage, value is an array type

  • form::city Provincial level two linkage, value is the array type

  • Form::cityarea Provincial Three-level linkage, value is the array type

  • form::checkbox check box

  • Form::color Color selection

  • Form::d ate Date selection

  • Form::d aterange Date range selection, value is array type

  • Form::d atetime date + Time selection

  • Form::d atetimerange date + time interval selection, value is array type

  • form::year Year selection

  • form::month Month selection

  • Form::frame Frame Components

  • form::frameinputs Frame component, input type, value is array type

  • Form::framefiles Frame component, file type, value is array type

  • form::frameimages Frame component, image type, value is array type

  • Form::frameinputone Frame component, input type, value String|number type

  • Form::framefileone Frame component, file type, value String|number type

  • Form::frameimageone Frame component, image type, value string|number type

  • Form::hidden Hidden components

  • form::number Digital input Box

  • form::input input box, other type:text type, Form::text password type Form::password , textarea type, Form::textarea URL type, Form::url email type Form::email , date typeForm::idate

  • form::radio Radio Box

  • Form::rate Scoring components

  • form::select Select selection box

  • form::selectmultiple Select box, multiple selection, value is array type

  • form::selectone Select selection box, radio

  • form::slider Slider Assembly

  • form::sliderrange Slider assembly, Interval selection,

  • form::switches Switch Assembly

  • Form::timepicker

  • form::time Time Selection component

  • form::timerange time interval Select component, value is array type

  • form::upload Uploading components

  • form::uploadimages Multi-image upload component, value is an array type

  • form::uploadfiles Multi-File Upload component, value is an array type

  • Form::uploadimageone Single-image upload component

  • form::uploadfileone Single File Upload component

Output

namespace \FormBuilder\Json

    • json::succ (msg,data = []) form submitted successfully

    • form::fail (errormsg,data = []) form submission failed

    • form::uploadsucc (filepath,msg) file/image upload successful, upload successful return file address

    • Form::uploadfail (errormsg) file/Picture upload failed

The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.