Notice: Undefined index: issue!!

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

Post Reply
tomex1
Forum Commoner
Posts: 26
Joined: Sun Aug 16, 2009 11:34 am

Notice: Undefined index: issue!!

Post by tomex1 »

Hello,
Could you please help me? I have form which runs a query depending on the fields filled in by the user. The form also has a checkbox. I keep getting Undefined index error when I try to submit the form without checking the box. This is not what I want as I want the checkbox selection to be optional. I have been trying to fix it but I just don't get how checkboxes work.
Any help you offer would be greatly appreciated.

Thanks
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: Notice: Undefined index: issue!!

Post by Darhazer »

Checkbox values are not send in the request, when they are not checked. This is by design.
So when you are checking if checkbox is checked, you have to use isset(), and not simply check the value
tomex1
Forum Commoner
Posts: 26
Joined: Sun Aug 16, 2009 11:34 am

Re: Notice: Undefined index: issue!!

Post by tomex1 »

Ahhh!! That explains a lot. Thanks ever so much Darhazer.
tomex1
Forum Commoner
Posts: 26
Joined: Sun Aug 16, 2009 11:34 am

Re: Notice: Undefined index: issue!!

Post by tomex1 »

Darhazer wrote:Checkbox values are not send in the request, when they are not checked. This is by design.
So when you are checking if checkbox is checked, you have to use isset(), and not simply check the value
Thanks a lot!! That worked for me.

Just ceasing the opportunity, do you know how to sort a table based on a column heading. At the moment, what I have got is a bit slow? This is due to the fact that my sort runs a query to the database and returns the result. I know there are other better ways of doing this but my knowledge of php isn't that deep.
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: Notice: Undefined index: issue!!

Post by Darhazer »

Post your code and we will see why it's slow 8)
Post Reply