I have 2 checkboxes on one page and a search button on another page that needs to take into consideration if the checkboxes are checked or not. I need to be able to search 4 different ways:
both checkboxes are checked
neither checkboxes are checked
checkbox1 is checked and checkbox 2 is not checked
checkbox1 is not checked and checkbox 2 is checked
Currently I have a stored procedure that has:
Select chkbox1, chkbox2 (database fields)
From table
Where conditions are equal
If chkbox1 = ‘Y’ and chkbox2 = ‘Y’ then
Select statement
Else if chkbox1 = ‘N’ and chkbox2 = ‘N’ then
Select statement
Else if chkbox1 = ‘Y’ and chkbox2 = ‘N’ then
Select statement
Else if chkbox1 = ‘N’ and chkbox2 = ‘Y’ then
Select statement
End if
This is not working in my stored procedure. How can I do this?