Page 1 of 1

[SOLVED]?act=stuff if you know what i mean?

Posted: Tue Oct 19, 2004 10:05 am
by Diod
Hey

I dont reallly know how to achieve the thing such as seen on many sites..

like index.php?act=del

i have the following currently

Code: Select all

if(isset($_GET['admin.php?act=post'])) {
}

if(isset($_GET['admin.php?act=edit'])) {
}

if(isset($_GET['admin.php?act=del'])) {
}

Posted: Tue Oct 19, 2004 10:12 am
by John Cartwright

Code: Select all

<?php
if($_GET['act'] == 'add'){

//do something

}
elseif($_GET['act'] == 'edit'){

//do something

}
elseif($_GET['act'] == 'del'){

//do something

}
?>

Posted: Tue Oct 19, 2004 10:13 am
by Weirdan

Code: Select all

switch($_GET['act']) {
    case 'post':
          // do something
          break;
    case 'edit':
          // do something else
          break;
    case 'del':
          // ...........
          break;
    default:
          header('Location: wrong_act.htm');
}

Posted: Tue Oct 19, 2004 10:16 am
by Diod
thx.. both :)

Posted: Tue Oct 19, 2004 10:18 am
by John Cartwright
I recommend a SWITCH in this case.

Posted: Tue Oct 19, 2004 10:21 am
by Diod
ah ok, ill use the switch then :) thx