Gossamer Forum
Home : General : Internet Technologies :

Navigation ListBox using PHP

Quote Reply
Navigation ListBox using PHP
Could someone help me with my list box. I am trying to create 2 list box menu dependant on each other. I have no idea where to start. I was thinking array with an if else statement would that be the easiest way to go about it?

Scenario - a movie database

I have
1. List of films
2. Features on that film

Further example,

A user would go to my site, he would see 2 list box menus side-by-side.
he would have to chose a film from list 1 and then a feature (e.g. preview) from list 2

And when he has selected both, depending on the film ID, the right preview page would be displayed.

What is the best way to go about writing a script for it. Any help is appreciated.

Thanks
Quote Reply
Re: [chokri] Navigation ListBox using PHP In reply to
Maybe something like this? (untested, and there is guaranteed to be a better way to do it);

Code:
<?php

$array = <<<CODE
Thing 1
Thing 2
Thing 3
Thing 4
Thing 5
Thing 6
CODE;

$sliced = explode("\n", $array);

foreach ($sliced as $line) {

$middle_html = "<option>$line</option>";

}

echo "<select size="1" name="FormName">";
echo $middle_html;
echo "</select>";

?>

Hope that helps :)

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Navigation ListBox using PHP In reply to
Thanks Andy,
I figured an array would be the easiest too. I will start with it.
Quote Reply
Re: [Andy] Navigation ListBox using PHP In reply to
That's why I hate php :)

Code:
my $options = map { qq|<option>Thing $_</option>\n| } (1..6);

Last edited by:

Paul: Jan 7, 2003, 3:59 PM