Notice: Undefined variable driving me crazy...

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 147
Joined: Tue Nov 19, 2002 7:47 am
Location: US, Ohio

Wed Feb 12, 2003 12:14 pm

you test if $add == "yes", but where does add get set? Seems like if it's an undefined variable, it is not getting set above the code you put into the msg.

perhaps make your if something like:

if(!empty($add) && $add == "yes") {

that will test to make sure it is set, is not empty and is equal to yes.

New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK

Thu Feb 13, 2003 2:24 am

if you have register_globals set to OFF (as you really should do) in your ini file, you will not be able to address passed variables except through their array collective.

if($_POST['add'] == "yes")


if($HTTP_POST_VARS['add'] == "yes")

one of those should do the trick.
avatar image based upon nasas apod (only updates if I post though)

Post Reply