https://github.com/thybag/formz
A Simple Stand-alone PHP Form Helper
https://github.com/thybag/formz
Last synced: 10 months ago
JSON representation
A Simple Stand-alone PHP Form Helper
- Host: GitHub
- URL: https://github.com/thybag/formz
- Owner: thybag
- Created: 2013-12-02T18:13:03.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-04-08T21:25:32.000Z (about 12 years ago)
- Last Synced: 2025-06-09T03:38:11.071Z (about 1 year ago)
- Language: PHP
- Size: 246 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FormZ
A Simple Stand-alone PHP Form Helper
## Installtion
FormZ can be installed via composer using:
composer require thybag/formz:dev-master
Once composer has installed the library, simply include the standard composer autoloader in to your code.
require 'vendor/autoload.php'
### Usage Examples
// Make Form refers to formz/Form
use formz\Form;
//Open form
Form::open("/somthing")->attributes(array("class"=>"test"))->render(true);
// Create a required text field with default value of "bob"**
Form::text("name")
->attributes(array('required'=>'required'))
->defaultValue("Bob")
->render(true);
// Select box with list of cows, css class cow_selector
// and default selection of Dexter**
Form::select("cow")
->options(array(
'A' => 'Angus',
'D' => 'Dexter',
'J' => 'Jersey',
'H' => 'Holstein'
))
->attributes(array('class'=> 'cow_selector'))
->defaultValue('D')
->render(true);
Form::close()->render(true);
You can have the form automatically populated from post data by calling the following before the form methods
Form::populate($_POST);