PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
pinehead18
Forum Contributor
Posts: 329 Joined: Thu Jul 31, 2003 9:20 pm
Post
by pinehead18 » Sun Jun 10, 2007 7:37 pm
Code: Select all
switch ($action) {
case $main:
main();
break;
case $main_post:
main_post();
break;
}
ok, when action=main_post it displays main(); instead of main post.
If i take out case $main, it displays right.
So in other words this thing is broken and for the life of me i can't figure out why.
If you help me i will love you... Virtually.
Thanks guys
Last edited by
pinehead18 on Sun Jun 10, 2007 10:12 pm, edited 1 time in total.
Benjamin
Site Administrator
Posts: 6935 Joined: Sun May 19, 2002 10:24 pm
Post
by Benjamin » Sun Jun 10, 2007 8:11 pm
I think you meant..
Code: Select all
switch ($action) {
case 'main':
main();
break;
case 'main_post':
main_post();
break;
}
pinehead18
Forum Contributor
Posts: 329 Joined: Thu Jul 31, 2003 9:20 pm
Post
by pinehead18 » Sun Jun 10, 2007 8:17 pm
Thanks for your response. However, when i changed it then nothing worked at all.
Suggestions?
Thanks
Anthony
bdlang
Forum Contributor
Posts: 395 Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US
Post
by bdlang » Sun Jun 10, 2007 8:19 pm
Does $action actually have a value? What is it at this point in the script?
The code example astions provided is correct, so your variable is either an empty or not a string (or not one that matches those two values).
Benjamin
Site Administrator
Posts: 6935 Joined: Sun May 19, 2002 10:24 pm
Post
by Benjamin » Sun Jun 10, 2007 8:23 pm
register_globals is probably turned off.
Z3RO21
Forum Contributor
Posts: 130 Joined: Thu Aug 17, 2006 8:59 am
Post
by Z3RO21 » Sun Jun 10, 2007 8:45 pm
astions wrote: register_globals is probably turned off.
As they should never be turned on, and yes make sure that data is in the $action variable.
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Sun Jun 10, 2007 9:13 pm
pinehead18
Forum Contributor
Posts: 329 Joined: Thu Jul 31, 2003 9:20 pm
Post
by pinehead18 » Sun Jun 10, 2007 10:14 pm
what would register_globals have anything to do with this?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Jun 10, 2007 10:18 pm
Do you set $action? If not, everything.
bdlang
Forum Contributor
Posts: 395 Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US
Post
by bdlang » Sun Jun 10, 2007 11:21 pm
pinehead18 wrote: what would register_globals have anything to do with this?
Did you ever check to see if
$action has a value?
pinehead18
Forum Contributor
Posts: 329 Joined: Thu Jul 31, 2003 9:20 pm
Post
by pinehead18 » Mon Jun 11, 2007 6:45 am
Ha, you ninja's rock. I just started a real job for the first time and my brain has been dead ever since.
$_GET got me going thanks guys!