Jump to content
MakeWebGames

Recommended Posts

Posted

So in most cases this has been my default/go to for defining a switch get action

 

$_GET['action'] = isset($_GET['action'])  && ctype_alpha($_GET['action']) ? $_GET['action'] : null;

 

But lately all that line has been doing is rendering an action unusable. As defining thing is my worst area, I think, can anyone help clue me in as to in which cases that line would not work.

Posted
So in most cases this has been my default/go to for defining a switch get action

 

$_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? $_GET['action'] : null;

 

But lately all that line has been doing is rendering an action unusable. As defining thing is my worst area, I think, can anyone help clue me in as to in which cases that line would not work.

 

if you have used that from my code that is because i don't use numbers when adding a new switch statement with a get variable

Posted
try this

 

$_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? $_GET['action'] : null;

 

that's what he used but he wants to allow numbers this only allows letters Zettieee is the right way or you could do a preg_replace

Posted

Because the warning isn't saying its null. The warning is saying that I hasn't been defined yet. This is where PHP gets stupid since $_GET and the like are global variables but it is trying to save you from a real error

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.   Paste as plain text instead

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