PHP code example of pleonovich / doform
1. Go to this page and download the library: Download pleonovich/doform library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pleonovich / doform example snippets
use DoForm\DoForm as DoForm;
// Description:
DoForm text ( string $name [, string $value = null [, string $extra = null ]] )
// Example:
echo DoForm::factory()->text('name');
// Result:
// <input type='text' id='name' name='name' value='' >
use DoForm\DoForm as DoForm;
// Description:
DoForm text ( string $name [, string $value = null [, $cols = 50 [, $rows = 3 [, $extra = null ]]]] )
// Example:
echo DoForm::factory()->textarea('biography');
// Result:
// <textarea id='biography' name='biography' cols='50' rows='3' ></textarea>
use DoForm\DoForm as DoForm;
// Description:
DoForm select ( string $name, array $options [, string $value = null [, string $extra = null ]] )
// Example:
echo DoForm::factory()->select('gender', array('male','famale'));
// Result:
// <select name='gender' id='select_gender' size='1' >
// <option value='male' >male</option>
// <option value='famale' >famale</option>
// </select>
use DoForm\DoForm as DoForm;
// Description:
DoForm selectIndexed ( string $name, array $options [, string $value = null [, string $extra = null ]] )
// Example:
echo DoForm::factory()->selectIndexed('gender1', array('1'=>'famale','2'=>'male'), '2');
// Result:
// <select name='gender1' id='select_gender1' size='1' >
// <option value='1' >famale</option>
// <option value='2' selected >male</option>
// </select>
use DoForm\DoForm as DoForm;
// Description:
DoForm selectFormated ( string $name, array $options [, string $value = null [, string $extra = null ]] )
// Example:
echo DoForm::factory()->selectFormated('gender2', array(array('1','famale'),array('2','male')), '2');
// Result:
// <select name='gender2' id='select_gender2' size='1' >
// <option value='1' >famale</option>
// <option value='2' selected >male</option>
// </select>
use DoForm\DoForm as DoForm;
// Description:
DoForm checkbox ( string $name [, string $value = null [, string $extra = null ]] )
// Example:
echo DoForm::factory()->checkbox('maried');
// Result:
// <input type='checkbox' id='maried' name='maried' />
use DoForm\DoForm as DoForm;
// Description:
DoForm _file ( [ string $name = "file" [, $multiple = true [, $extra = null ]]] )
// Example:
echo DoForm::factory()->_file('avatar');
// Result:
// <input type='file' name='avatar[]' multiple='true' >
use DoForm\DoForm as DoForm;
// Description:
DoForm submit ( string $name [, $extra = null ] )
// Example:
echo DoForm::factory()->submit('Send');
// Result:
// <input type='submit' name='Send' >
use DoForm\DoForm as DoForm;
$form = DoForm::factory()
->text('name')
->textarea('biography')
->select('gender', array('male','famale'))
->selectIndexed('gender1', array('1'=>'famale','2'=>'male'), '2')
->selectFormated('gender2', array(array('1','famale'),array('2','male')), '2')
->checkbox('maried')
->_file('avatar')
->submit('Send');
use DoForm\DoInput as DoInput;
$input = DoInput::text('name');
$input.= DoInput::textarea('biography');
$input.= DoInput::select('gender', array('male','famale'), 'famale');
$input.= DoInput::selectIndexed('gender', array('1'=>'famale','2'=>'male'), '2');
$input.= DoInput::selectFormated('gender', array(array('1','famale'),array('2','male')), '2');
$input.= DoInput::checkbox('maried');
$input.= DoInput::_file('avatar');
$input.= DoInput::submit('Send');