Ternstyle

Ternstyle

A web software and design firm

HTML Select Element PHP Class

HTML Select Element PHP Class

Often when creating databasing applications with front-end or back-end user interfaces it’s necessary to create HTML form select elements from database record sets or other arrays. This class offers a very easy and efficient way to compile these form elements with one command.

Download Version: 4.5

Current Version

The current version of this software is 4.5.

Sample Code

$array = array("key1"=>"value1","key2"=>"value2");
$select_class = new selectClass();
$object = $select_class->select($array,'id','name','title','class');

The above variable $object will be an HTML form element which will print to a page like so:

<select id="id" name="name" title="title">
	<option value="value1">key1</option>
	<option value="value2">key2</option>
</select>

Features

  • Compile HTML select elements from arrays, associative arrays or multi-dimensional arrays.
  • Compile select elements with a value initially selected
  • Compile multi-select elements with multiple values initially selected
  • Use values in the specified array as the initially selected value
  • Create custom default selected values
  • Compile select elements from ranges of numbers
  • Create tiered select elements
  • Assign javascript functions to the select element’s onChange event.

Requirements

  • PHP 4.0+

Documentation

HTML Select Element PHP Class

Connect with us

We dig the back-and-forth.

Copyright © 2018 Ternstyle LLC. All rights reserved.