FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » dropdown menus
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: dropdown menus [message #184012 is a reply to message #184008] Mon, 02 December 2013 14:09 Go to previous messageGo to previous message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma:
Senior Member
On 12/1/2013 6:25 PM, richard wrote:
> 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.

Discuss what? How to assemble a select box from an array?

> When they do discuss the rest, they use a database.

The rest of what?

> 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[][].

If you want it done with a simple selection of a drop down on your
CLIENT, do YOU think with PHP being for the most part SERVER side that
PHP can do it?

OK OK don't hurt yourself, the answer for YOU is use JS.

Secondly, javascript again for the most part being CLIENT driven, what
array have you sent to the clients browser?

> FYI, when you visit the page, slow systems may take awhile.
> The file size is around 2mb.

How in the heck do you have a 2mb page file? Never mind I don't think I
want to know.


Scotty
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: video sharing website
Next Topic: sorting readdir output?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 12:35:50 GMT 2024

Total time taken to generate the page: 0.04209 seconds