[SOLVED] Undefined index not sure where i'm going wrong

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

PAW Projects
Forum Commoner
Posts: 30
Joined: Tue Jun 15, 2004 7:43 am
Contact:

Post by PAW Projects »

Excellent!

You're getting that error because you're checking $_POST['q1'] for its value, while it isn't set (you didn't check the q1 checkbox).
Instead of checking the value, check if $_POST['q1'] is set first.
The same goes for q2 obviously.
stantheman
Forum Commoner
Posts: 38
Joined: Wed May 26, 2004 8:57 am

Post by stantheman »

When i check them i get my value but when unchecked like you say i get undefined how to i work around not having them checked
PAW Projects
Forum Commoner
Posts: 30
Joined: Tue Jun 15, 2004 7:43 am
Contact:

Post by PAW Projects »

Code: Select all

<?

if (isset($_POST['q1'])) {
  echo 'The first box has been checked!';
} else {
  echo 'The first box has NOT been checked!';
}

?>
stantheman
Forum Commoner
Posts: 38
Joined: Wed May 26, 2004 8:57 am

Post by stantheman »

THanks it works know, Thanks for all the help i'm new to this php stuff, I'll get the hang of it soon. Thanks AGain for everones help
Post Reply