Reputation: 19
I'm trying to make multiple pages in 1 file and i have this
<?
switch($action){
case "add":
add();
break;
default:
hello();
break;
}
function add() {
echo "hello";
}
function hello() {
echo "hello1";
}
?>
but when I got to ****.php?action=add
I still get "hello1"
what am I doing wrong with this to where I get hello
Upvotes: 0
Views: 213
Reputation: 5038
<?php
$action= $_GET['action']
//$_REQUEST, by default, contains the contents of $_GET, $_POST and $_COOKIE.
// $action= $_REQUEST['action'];
switch($action){
case "add":
add();
break;
default:
hello();
break;
}
function add() {
echo "hello";
}
function hello() {
echo "hello1";
}
?>
Upvotes: 0