constructor which sets the table and fields to use from database when creating the form.
mySqlForm
__construct
(string $table, array $fields, [array $initValues = null])
-
string
$table: the table to use when creating the form.
-
array
$fields: if set the fields to use with the form.
-
array
$initValues: defulat init values when inserting
Redefinition of:
- db::__construct()
- constructor will try to call method connect
Method that will create the actual form
Same documentation as in PEAR::HTML_Form
void
createForm
(string $action, [string $method = 'post'], [string $name = ''], [string $target = ''], [string $enctype = ''], [string $caption = ''])
-
string
$action: the string naming file or URI to which the form should be submitted
-
string
$method: a string indicating the submission metho 'get' or 'post')
-
string
$name: a string used in the <form>'s 'name' attribute
-
string
$target: a string used in the <form>'s 'target' attribute
-
string
$enctype: a string indicating the submission's encoding
-
string
$caption: a string of additional attributes to be put in the element (example: 'id="foo"')
void
setLabels
(array $labels)
-
array
$labels: labels for form elements.
method for setting crud method (no read)
void
setMethod
(string $method, [ $id = null])
-
string
$method: insert, update or delete.
-
$id
method for creating a connection to another table. E.g. if we have a dropdown with categories from another table and want to display this category as a dropdown of options, we use setToMany
void
setToMany
(string $field, string $table, string $id, string $title, [string $type = 'dropdown'])
-
string
$field: field which field do we map to many
-
string
$table: table which table do we use in db
-
string
$id: id which column will act as id ('id')
-
string
$title: title which column will act as title
-
string
$type: type (only dropdown is supported right now)
Inherited Methods
Inherited From db
db::__construct()
db::connect()
db::delete()
db::fatalError()
db::getDebug()
db::getNumRows()
db::insert()
db::prepareToPost()
db::rawQuery()
db::select()
db::selectAll()
db::selectOne()
db::selectQuery()
db::simpleSearch()
db::simpleSearchCount()
db::update()