Jump to content

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();

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.