Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMichael Wisniewski
8,906 PointsHow would you write the code for Radio Buttons and Checkboxes that must contain a value?
I have defined my radio buttons and checkboxes just as every other variable in the beginning of the file. When a user submits the form without checking the required checkboxes and/or marking the required radio buttons, my error messages still display correctly - However, it always states that the checkboxes & radio buttons are 'NOTE: Undefined Index...' at the very top of the page, which pushes my header file out of the way.
How can I re-write the code to correctly display the error messages without these Undefined Index messages displaying as well?
1 Answer
Christer Austad
8,373 PointsHi.
First off, it always helps when you provide us with your code when asking for help. See the "Markdown Cheatsheet" for instructions.
An undefined index notice is raised when you try to access a variable that don't exist. Have a look here