dropdown menus [message #184008] |
Mon, 02 December 2013 02:25 |
Mr Oldies
Messages: 241 Registered: October 2013
Karma:
|
Senior Member |
|
|
http://mroldies.net/test/all60.php
working model
<?php
//Array contents array 1 :: value
$myArray1 =
array('1960','1961','1962','1963','1964','1965','1966','1967','1968','1969' );
//Array contents array 2 :: key => value
$myArray2 =
array('1'=> 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S' ,'T','U','V','W','X','Y','Z');
//Values from array 1
echo'<select name="Year">';
echo "<br>";
//for each value of the array assign a variable name word
foreach($myArray1 as $word){
echo'<option value="'.$word.'">'.$word.'</option>';
echo "<br>";
}
echo'</select>';
echo "<br>";
//Values from array 2
echo'<select name="Letter">\n';
echo "<br>";
//for each key of the array assign a variable name let
//for each value of the array assign a variable name word
foreach($myArray2 as $let=>$word){
echo'<option value="'.$let.'">'.$word.'</option>\n';
echo "<br>";
}
echo'</select>';
echo "<br>";
?>
Again, all the sites I visit discuss this part of things.
When they do discuss the rest, they use a database.
For this excercise, I am NOT using a database. Just a straightforward 2d
array on the page itself.
My goal is to populate the left column with the selected 2 items.
Showing the list of names.
Then the right column will show more data on that selected name.
I can do this fairly easily with an iframe, but I want to try NOT using an
iframe for once.
If I have to do this part with javascript, that's not a problem.
But, can javascript use the same php array as I have it?
My array now is in the form of $test[][].
FYI, when you visit the page, slow systems may take awhile.
The file size is around 2mb.
|
|
|