PHP Classes

classListbox: Generate form select inputs from database queries

Recommend this page to a friend!
  Info   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 1,210 All time: 3,131 This week: 227Up
Version License Categories
classlistbox 1.0GNU General Publi...HTML, Databases


This class can be used to create form select inputs from MySQL database query results, similar to ASP.NET listbox control.

The class can execute a given MySQL dquery that extracts the option names and the respective values. Then it generates a form select input with the given values. A given value can be displayed as the initially selected value.

Optionally, the class may also generate the necessary Javascript code to make the form of the input be automatically submitted when the user changes the input value.

Picture of Carlos Miguel Guevara
  Performance   Level  
Name: Carlos Miguel Guevara <contact>
Classes: 3 packages by
Country: Mexico Mexico
Age: 41
All time rank: 3734 in Mexico Mexico
Week rank: 578 Down5 in Mexico Mexico Down

Notes: -easy usage -Just create a new object classListbox -Dont forget to set the name when creating the object. this name is the name of the <select> -In the set_query method you should send the query and the primary key or the id you use to identify each register -dont forget to add this primary key to the select query ex: if your key is "productID" and you want to get the "productname", your query should look like this: $object->setquery("selet productname,productID from products","productID") -have fun! -You can make the page refresh th data by doing a submit by using the $object->set_postback("true") or disable it by using $object->set_postback("false") just like in -Each time you chage the selected value from the listbox a submit event is call to refresh the content of the item if set_postback is set to "true" -to avoid submitting the form you can modify your form by getting a name to your submit button ... any questions:
  Files folder image Files  
File Role Description
Plain text file classListbox Class the class file
Accessible without login Plain text file estilo.css Data style sheet
Accessible without login Plain text file example.php Example example
Accessible without login Plain text file mydatabase.sql Data the database for the example
Accessible without login Plain text file readme.txt Doc. Notes of usage

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:3,131
This week:227Up
User Comments (1)
13 years ago (kishore kumar)