Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Undefined index: formAction 3

Status
Not open for further replies.

kabir06

Programmer
Aug 18, 2006
4
US
Hello..

I'm new to PHP... I looked for answers to this on google, lots of alternatives were given...

the code works perfectly on another website, i copied it over to my pc...and trying running it using localhost and i get errors about undefined variables

i tried turning the register_globals = on in php.ini. I still get the errors...

when i wrap the $(_GET['formAction']) with an isset(), i don't get the error...is this what I'm supposed to do for all the global variables going forward? any other workarounds?

 
Pretty much. Since you will know what items you are testing for, and which ones will always be there, you only need to test for the ones that might not be there, like <select>, <checkbox>, <radio>, etc.

Take Care,
Mike
 
For debugging purposes, you can use var_dump on your $GET to see what's really there.
 
the undefined index error is a raised by php to tell you that you have tried to address an element of an array that is not set. it is not a fatal error and code will continue to execute.

you will not get this error on a production machine as typically the error display is set not to display warnings and notices.

on a dev machine you won't get this error if you wrap your code in an isset as you are conditionalising the addressing of the element. imho you should always use isset on elements of the GPC superglobals as you can never control what a user actually does to your application
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top