Entry
How can I populate a pull down with with a few data fields from one table and then upon selection then intire row fills out the apropiate form fields?
Feb 18th, 2008 19:31
dman, Philip Olson, Kelson Vibber, Greg West, http://www.ttnr.org
You'll need to combine PHP with JavaScript for this one.
In the <head> area of the HTML page, write some JavaScript to define
several arrays (or a single, multidimensional array) containing the data
you want to use for the form. You'll need to use PHP to generate the
JavaScript code that defines the arrays.
In the same block of JavaScript, write a function that takes the
selected value from the pull-down menu and chooses which array or array
slice to use and fill in the form.
In the form, define the pull-down menu using a <select> tag, and assign
the function you created above to the onChange attribute. Then use PHP
to generate the <option> tags for the menu items.
A couple tutorials exist on this subject, they are as such :
chainedSelectors: A Better Way to Drop-down a PHP List :
----------------------------------------------------------
http://www.zend.com/zend/tut/drop-down.php
Loading JavaScript Arrays with MySQL Data :
----------------------------------------------------------
http://devshed.com/Server_Side/MySQL/JS_Arrays/