Jump to content

[SOLVED] writing a simple php processing form


blueman378

Recommended Posts

hi guys i am linking to a page called catprocess.php via catprocess.php$action=Delete

or catprocess.php$action=Browse

you get the idea, anyway i was wondering how would i preform different functions based on the $action variable?

 

eg we have a function called browse,

and one called delete,

if action=delete preform delete function else if action = browse preform browse funxtion

 

thanks

 

btw i know i can use else ect but im looking for a tidier way thanks :)

<?php

$action = $_GET['action'];

if ($action == "browse")
{
function doSomething()
{
// browse script here
echo "You Are Now Browsing";
}
}
else if ($action == "delete")
{
function doSomething()
{
// delete script here
echo "Delete Complete";
}
}
else {
function doSomething()
{
echo "No Action Specified!";
}
}

doSomething();

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.