Download the PHP package drw/php-form without Composer
On this page you can find all versions of the php package drw/php-form. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package php-form
Short Description This form is use to generate HTML form using PHP
License MIT
Homepage https://github.com/gbengawale/php-form
Informations about the package php-form
As a web programmer, you know form is an integral part of the web(infact, the web engine, almost all we do is based on form). Now, to create a complete form that is not easily hackable, you need to include csrftoken
, escaping to prevent XXS attacks
, and the potential complications of handling one-to-many relationships
they’re really too tedious to code from scratch every time, and, if you forget the csrftoken or a call to htmlspecialchars, you have a security hole. So, I created this Form plugin
that has methods for many of the elements that a form can contain, and you can easily add additional methods as needed.
Usage Installing the plug-in You can install the plug-in in two ways through
- composer
composer require drw/php-form
(recommended) - You can download the package, extract it and it include or require it
Supported HTML input type
The supported input types include
The form start
: begins the form and outputs the opening <form ...>
tag, with two optional arguments. The first is
an array of values to be displayed, indexed by field name. Typically, it’s the$_POST
array from another form submittal
or a row retrieved from the database. The second argument is the action, but almost always you want to go back to the
same file. The csrftoken is placed into every form.
form end
finishes the form.
The text method: text($field, $label/*could be null*/, $len/* default is 50*/, $placeholder/* Could also be null*/, $break/*default is true*/, $password/*this incdicates if the field is password or text*/, $value )
The label method: label($field, $label/*the label could be null*/, $break/*break could be true or false*/)
The button method: button($field, $label/*The label could be null*/, $break/*default is true but coud also be false)
The hspace method: hspace(/*It recieve no parameter*/)
The checkbox method: checkbox($field, $label/*this parameter could also be null*/, $break/*break could be true or false*/)
The radio method: radio($field, $label/*this parameter could also be null*/, $value, $break/*break could be true or false*/)
The date plugin date($field, $label/*this parameter could also be null*/, $break/*break could be true or false*/)
This is an example of how to use it.
require __DIR__ . '/path/to/file';// Supposing you use the second method to use this plugin,