problem with switch action...

[email protected] (Colin Gray)
Newsgroups php.general
Message-ID <B54609E8.12ED%[email protected]>
I'm taking my first stab at creating a PHP page.  I'm trying to put together
a php page where you can have index.php3?action=something  so I will be able
to concentrate my scripts into one file.  I have tried using the switch
function a shown below, and the if elseif else statement, also show below.
Whenever I run it on the server, it will throw line errors, and won't switch
the action variables value.  note: i've tried the cases with the switch
function with and without quotes.  Can anyone help me?

if (empty ($action))
    $action=home;

switch ($action)
{
case "home":
    search ();
    break;
case "admin":
    passprompt ();
    break;
case "newrecord":
    passprompt (newrecord);
    newrecord ();
    break;
case "deleterecord":
    passprompt (deleterecord);
    search ();
    break;
case "submitrecord":
    search ();
    break;
case "search":
    search ();
    break;
default:
    die ("Unknown action code ($action)");
}




if ($action=home) {
        print ("this is home\n");
    } elseif ($action=pagetwo) {
        print ("this page 2\n");
    } else {
        print ("unknown action code\n");
    }



Thanks

Colin Gray
chaunessy creative web solutions
[email protected]
www.chaunessy.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.