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
Switch to threaded view of this topic Create a new topic Submit Reply
dropdown menus [message #184008] Mon, 02 December 2013 02:25 Go to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
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.
Re: dropdown menus [message #184012 is a reply to message #184008] Mon, 02 December 2013 14:09 Go to previous messageGo to next message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
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
Re: dropdown menus [message #184013 is a reply to message #184012] Mon, 02 December 2013 15:01 Go to previous messageGo to next message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma: 0
Senior Member
On Mon, 02 Dec 2013 06:09:18 -0800, Scott Johnson wrote:

> 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

6900 rows, 12 columns with lots of data in each cell.
All those quotes, [], and = add up.
Re: dropdown menus [message #184015 is a reply to message #184013] Mon, 02 December 2013 15:35 Go to previous message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma: 0
Senior Member
richard wrote:

> On Mon, 02 Dec 2013 06:09:18 -0800, Scott Johnson wrote:
>
>> On 12/1/2013 6:25 PM, richard wrote:
>>
>>> 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.
>
> 6900 rows, 12 columns with lots of data in each cell.
> All those quotes, [], and = add up.

You may consider using some kind of pagination. :)

--
Christoph M. Becker
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: video sharing website
Next Topic: sorting readdir output?
Goto Forum:
  

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

Current Time: Thu Nov 21 17:56:50 GMT 2024

Total time taken to generate the page: 0.03265 seconds