Selection menu help needed

Hi Guys,


I have a selection menu that is generated via php and a backend database.
the code is working.


What I want to do is take a selection from the menu then select a table of
results based on that key.

I have the code to select & build the table, but i am having problems tieing
the selection box to trigger the table update.


Javascript is out , incase it is disabled, I have no Ajax , all i have is
PHP.


Thanks

Steve
Steve [ So, 20 Mai 2007 01:16 ] [ ID #1715990 ]

Re: Selection menu help needed

steve wrote:
> Hi Guys,
>
>
> I have a selection menu that is generated via php and a backend database.
> the code is working.
>
>
> What I want to do is take a selection from the menu then select a table of
> results based on that key.
>
> I have the code to select & build the table, but i am having problems tieing
> the selection box to trigger the table update.
>
>
> Javascript is out , incase it is disabled, I have no Ajax , all i have is
> PHP.

Then you have only two options, reload the whole page or use frames, which is
better, that you should ask at alt.html or do as you feel is easiest.


Assuming we use one page (no frames), you need to give arguments to the links
in your menu

The menu element 1
The menu element 2
The menu element 3

In the page you need to take care of the value sent, IMHO it's easiest to do
that in a switch-case:

<?PHP
// place this where the table is supposed to be
$drawtable=true;
switch($_GET['varibletobesent']) {
case 1:
$query="SELECT * FROM Table1";
break;
case 2:
$query="SELECT * FROM Table2";
break;
case 3:
$query="SELECT * FROM Table3";
break;
default:
$drawtable=false;
break;
}

if($drawtable) {

//Do what you need to draw the table
} else {
if(isset($_GET['varibletobesent'])) {
//give some nice error message
}
// draw the page section as it should be without the table
}
?>

Of course you may need to do all the table drawing in the switch case if you
can't make a general drawing function for all tables.

If you need to send more than one variable, then the anchor-tag could look
something like:

<a href="this.page?varibletobesent=1&nextpage=<? $nextpage?>">The menu
element 1</a>

the '&' is what you put between the variables to be sent (it's just the &
character, but using the plain '&' will generate invalid code at w3c.


--

//Aho
Shion [ So, 20 Mai 2007 09:51 ] [ ID #1715991 ]

Re: Selection menu help needed

Post removed (X-No-Archive: yes)
Notifier Deamon [ Mi, 23 Mai 2007 19:08 ] [ ID #1720970 ]
PHP » alt.php » Selection menu help needed

Vorheriges Thema: When is $_POST set and unset?
Nächstes Thema: Looking for a good Php book to use with Adobe CS3