Page 1 of 1

Notice: Undefined index: issue!!

Posted: Thu Sep 03, 2009 5:43 pm
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

Re: Notice: Undefined index: issue!!

Posted: Thu Sep 03, 2009 5:49 pm
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

Re: Notice: Undefined index: issue!!

Posted: Thu Sep 03, 2009 5:53 pm
by tomex1
Ahhh!! That explains a lot. Thanks ever so much Darhazer.

Re: Notice: Undefined index: issue!!

Posted: Thu Sep 03, 2009 6:11 pm
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.

Re: Notice: Undefined index: issue!!

Posted: Thu Sep 03, 2009 6:16 pm
by Darhazer
Post your code and we will see why it's slow 8)