Page 1 of 1

Building a menu

Posted: Wed Jun 25, 2003 10:37 am
by JeffElkins
Howdy,

I need to implement a selection menu within a php program for navigation to it's various functions. Currently, I'm hard-coding a single choice:


function1();
// function2();
// function3();

So, obviously, function1 executes in the case above. How can I present a menu so the user can choose a particular function? Or, can I call the program with a desired starting point?

i.e. program.php?function3();

Thanks!

Posted: Wed Jun 25, 2003 11:10 am
by phice
Easily done. In a link, set the variable 'view' (or whatever you like) to style1. IE: program.php?view=style1 or program.php?view=style2

Code: Select all

<?php
if ($view == "style1")
{
// Include function 1
function1();
}
elseif ($view == "style2")
{
// Include function 2
function2();
}
else
{
function_default();
}
?>
Hope this is what you were looking for.

Posted: Wed Jun 25, 2003 1:31 pm
by JeffElkins
Thanks!