PHP Database Form requires web server that supports PHP 5.3 and higher.
- PHP 5.3 or later
- Apache, Tomcat, or Microsoft IIS web server
PHP Database Form supports all major databases:
PHP Database Form Supports all major web browsers:
PHP Database Form requires web server that supports PHP 5.3 and higher.
PHP Database Form supports all major databases:
PHP Database Form Supports all major web browsers:
PHP Database Form constructor takes three parameters. Use this method to create the PHP Database Form object. Usually this is the first line in your code.
Signature:
Parameters:
Example:
set_label(mixed $col, mixed $label) : $this
Set form element label
mixed | $col |
|
mixed | $label |
|
set_dimension(mixed $col, int $cols, int $rows) : $this
Set control dimension width and height. Note that this is not the same as set_form_dimension().
It is used with text type only. For column type text, the width is translated to “size”, its height is ignored. for text area, the width is translated to “cols” and height to “rows”
mixed | $col |
|
int | $cols |
|
int | $rows |
|
set_form_dimension(mixed $f_width, string $f_height) : $this|void
Set form width and height. Overwrites parent definition for template.
mixed | $form_width |
|
string | $form_height |
|
set_default(mixed $col, string $default) : $this
Set control default value for a field
mixed | $col |
|
string | $default |
|
set_readonly(array $cols) : $this
Set one more more columns as read only field. Note that the parameter is an array.
array | $cols |
|
set_required(array $cols) : $this
Set required fields. The parameter is an array that can take one or more fields.
array | $cols |
|
set_placeholder(mixed $col, mixed $ph_text) : $this
Placeholder text for HTML form element.
mixed | $col |
|
mixed | $ph_text |
|
set_border(mixed $border_style) : $this
Set form border using CSS stylesheet
mixed | $border_style |
|
set_ctrltype(mixed $col, mixed $ctrltype, null $keyvalue_pair, bool $multiple) : $this
Set HTML control type of a specific field. Select and Textare control types are automatically determined by the database field char type based on its length. But you can set it otherwise.
mixed | $col |
|
mixed | $ctrltype |
|
null | $keyvalue_pair |
|
bool | $multiple |
|
set_maxlength( $col, $maxlength)
Set max input length for a field
mixed | $col |
|
int | $maxlength |
|
set_editrule(mixed $col, mixed $rule_func) : $this
Custom data validation rules. The 2nd parameter is a the JavaScript function name used for data validation.
mixed | $col |
|
mixed | $rule_func |
|
display(bool $render_content)
Display our database form. This should be LAST method to call.
bool | $render_content |
|
load_form(mixed $key) : $this
Load an existing entry from DB.
mixed | $key |
|
redirect_after_submit(mixed $url) : $this
Redirect form after submit. It does not check whether the submit is success.
mixed | $url |
|
add_group_header(mixed $before_col, mixed $header) : $this
Add caption to a subgroup. This adds visual elements thats help users to better navigate the form
mixed | $before_col |
|
mixed | $header |
|
add_captcha() : $this
Add CAPTCHA* (“Completely Automated Public Turing test to tell Computers and Humans Apart”), a type of challenge-response test used in computing to determine whether or not the user is human.
* phpDatabaseForm uses realperson jQuery plugin available under MIT license.
set_mask(mixed $col, mixed $mask, string $extra_prop)
Provides a general format to text field and enforce it’s structure as the user types in values.
It gives the user an idea about how they should enter the data.
Parameters
mixed | $col |
|
mixed | $mask |
|
string | $extra_prop |
|
phpDatabaseForm uses jQuery Mask Input created by Igor Escobar http://igorescobar.github.io/jQuery-Mask-Plugin/ available under MIT license.