/php/lib/forms.php

Description

Form functions for handling form input, output, and markup.

Functions
array_days (line 76)

Get calendar days in array format.

  • return: days from 1->[28-31] (zero-filled)
array array_days ([int $month = ''], [int $year = ''])
  • int $month: numeric representation of month (optional) default is empty, accepted range value is 1-12 inclusive, this affects the total number of days in given month
  • int $year: the year (optional) default is empty, this affects the total number of days in given month
array_hours (line 159)

Get calendar hours in array format.

  • return: hours (zero-filled)
array array_hours ()
array_minutes (line 187)

Get array of minutes.

  • return: minutes (zero-filled)
array array_minutes ([int $interval = 15])
  • int $interval: interval between minutes (optional) default is 15
array_months (line 105)

Get calendar months in array format.

  • return: months from 01-12 (zero-filled)
array array_months ()
array_states (line 203)

Get array of states.

  • return: states (abbr=>fullname)
array array_states ()
array_years (line 130)

Get calendar years in array format.

  • return: years
array array_years ([int $num = 5], [int $year = ''])
  • int $num: number of years to display (optional) default is 5, negative numbers change direction of array
  • int $year: starting year (optional) default is this year
clean_in (line 41)

Cleans a string or an array of strings for DB input.

  • return: slashes added, if necessary
mixed clean_in (mixed $str, [mixed $single_quotes = FALSE], [bool $decode = FALSE], bool $single_quote)
  • mixed $str: dirty
  • bool $single_quote: add single quotes around the string, optional
  • bool $decode: run html_entity_decode(), optional
clean_out (line 14)

Cleans a string or an array of strings for HTML presentation.

  • return: cleaned for HTML
mixed clean_out (mixed $str, [bool $slashes = FALSE])
  • mixed $str: dirty
  • bool $slashes: default to false, this parameter indicate if stripslashes is desired, usually use for magic qoutes
db_get_to_options (line 650)

Take a db_get result and return an array of options.

  • return: array of options ($val=>$text)
array db_get_to_options (array $data, string $val_col, string $name_col)
  • array $data: db_get result
  • string $val_col: column containing the value for each option
  • string $name_col: column containing the text
form_array_fix_dates (line 532)

Fix dates for form display, or proper db entry

  • return: null, or the original array modified to have separated date values for the forms
mixed form_array_fix_dates (array $dates, array $datetimes, [int $way = 1], [array $orig = ''])
  • array $dates: array of date field names
  • array $datetimes: array of datetime field names
  • int $way: 1 is done after a post, 2 is done when selecting for forms
  • array $orig: for way 2, the array we need to add the separated date values to (usually $posts)
form_array_get_date (line 587)

Get put a date back together after a POST.

  • return: repaired date, as an array that corresponds to the form
array form_array_get_date (string $field, int $key)
  • string $field: name of post index of date field
  • int $key: index of form array that the field value belongs to
form_array_get_datetime (line 603)

Get put a datetime back together after a POST.

  • return: repaired datetime, as an array that corresponds to the form
array form_array_get_datetime (string $field, int $key)
  • string $field: name of post index of datetime field
  • int $key: index of form array that the field value belongs to
form_checkbox (line 359)

Writes a checkbox input.

void form_checkbox (string $name, [string $id = null], [string $class = null], [string $value = null], [bool $checked = 0], [string $extra = null])
  • string $name: name of field
  • string $id: id of field, must be unique per page
  • string $class: css class
  • string $value: value
  • bool $checked: checked?
  • string $extra: any extra parameters (optional)
form_end (line 289)

Writes the ending form tag.

void form_end ()
form_hidden (line 454)

Writes a hidden field.

void form_hidden (string $name, [string $value = null], [string $extra = null])
  • string $name: name of field
  • string $value: value
  • string $extra: any extra parameters (optional)
form_label (line 301)

Writes a form input label.

void form_label ([string $text = null], [string $for = null], [string $class = null], [string $extra = null])
  • string $text: label text
  • string $for: id of corresponding field
  • string $class: class css class of label
  • string $extra: any extra parameters (optional)
form_password (line 340)

Writes a password input.

void form_password (string $name, [string $id = null], [mixed $class = null], [int $size = '30'], [int $maxlength = '100'], [string $extra = null], string $css)
  • string $name: name of field
  • string $id: id of field, must be unique per page
  • string $css: css class
  • int $size: size of field (optional) default is 30
  • int $maxlength: maxlength of field (optional)
  • string $extra: any extra parameters (optional)
form_radio (line 391)

Writes a radio input.

void form_radio (string $name, [string $id = null], [string $class = null], [string $value = null], [bool $checked = 0], [string $extra = null])
  • string $name: name of field
  • string $id: id of field, must be unique per page
  • string $class: css class
  • string $value: value
  • bool $checked: checked?
  • string $extra: any extra parameters (optional)
form_reset (line 439)

Writes a reset input.

void form_reset (string $name, [string $class = null], [string $value = 'Reset'], [string $extra = null])
  • string $name: name of field
  • string $class: css class
  • string $value: value (button text)
  • string $extra: any extra parameters (optional)
form_select (line 477)

Writes a select list with options.

void form_select (string $name, [string $id = null], [string $class = null], [array $options = null], [string $selected = null], [string $extra = null])
  • string $name: name of field
  • string $id: id of field, must be unique per page
  • string $class: css class
  • array $options: possible options, usually pulled from db, or array_* funcs
  • string $selected:

    if the value matches, it is selected

    Multiple selects based on sets come out of a database as val,val,val so the explode was intended to create the instance of an array based on the string regardless of whether or not it has val,val,val.

  • string $extra: any extra parameters (optional)
form_start (line 276)

Writes the beginning form tag.

void form_start ([string $name = 'form'], [string $class = null], [string $method = 'post'], [string $action = null], [mixed $extra = null])
  • string $name: form name
  • string $class: class name
  • string $method: method (post or get)
  • string $action: action
form_submit (line 422)

Writes a submit input.

void form_submit (string $name, [string $id = null], [string $class = null], [string $value = 'Submit'], [string $extra = null])
  • string $id: the id attribute
  • string $name: name name of field
  • string $class: css class
  • string $value: value (button text)
  • string $extra: any extra parameters (optional)
form_text (line 321)

Writes a text input.

void form_text (string $name, [string $id = null], [mixed $class = null], [string $value = null], [int $size = '30'], [int $maxlength = '100'], [string $extra = null], string $css)
  • string $name: name of field
  • string $id: id of field, must be unique per page
  • string $css: css class
  • string $value: value
  • int $size: size of field
  • int $maxlength: maxlength of field
  • string $extra: any extra parameters (optional)
form_textarea (line 513)

Writes a textarea

void form_textarea (string $name, [string $id = null], [string $class = null], [int $rows = '6'], [int $cols = '50'], [string $value = null], [string $extra = null])
  • string $name: name of field
  • string $id: id of field, must be unique per page
  • string $class: css class
  • int $rows: number of rows (height)
  • int $cols: number of cols (width)
  • string $value: value of field
  • string $extra: any extra parameters
is_email_address (line 618)

Validates email addresses

bool is_email_address (string $email)
  • string $email
is_phone_number (line 628)

Validates phone number

bool is_phone_number (string $phone)
  • string $phone
url_out (line 638)

Returns http:// and the string if the string does not begin with http://

string url_out (string $url)
  • string $url

Documentation generated on Mon, 8 Nov 2004 13:43:04 -0800 by phpDocumentor 1.3.0RC3