1 Replies - 2454 Views - Last Post: 02 May 2011 - 07:36 AM Rate Topic: -----

#1 Raywin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 29-April 11

[question] dynamic multiple checkbox and get result with database

Posted 30 April 2011 - 07:40 AM

Hello everyone, i am facing a problem with multiple checkbox.
I have set few checkbox as a selection, then send to database for search result.
For example the checkbox including hotel features like, aircont, 24 hour reception, swiming pool etc.
after tick the check box , will send to result page to get the Hotel match with the selection checkbox.

But my level only can make just one selection and get the result, if choose more than 1 selection will get error.

<--- HTML Page --->
<cfform action="test_action.cfm">
    <cfoutput query="Features">
    <input type="checkbox" name="FeatureID" value="#FeatureID#">#Feature# <br 						           </cfoutput>
     <input type="submit" value="Search">

<--- Query Page --->
<cfparam name="FORM.HotelID" default="">

<cfquery name="Hotel" datasource="#ds#">
SELECT Hotel_ID, Name
FROM Hotel
<cfif FORM.HotelID IS NOT "">
 AND HotelID = #FORM.HotelID#

<cfoutput query="Hotel">

Is This A Good Question/Topic? 0
  • +

Replies To: [question] dynamic multiple checkbox and get result with database

#2 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 2024
  • View blog
  • Posts: 3,609
  • Joined: 13-January 08

Re: [question] dynamic multiple checkbox and get result with database

Posted 02 May 2011 - 07:36 AM

The number of checkboxes you're seeing from line 4 (within the cfoutput loop starting on line 3) will be determined by the number of records your Features query came back with.

Further, your line 4 should close the "break" tag so it'd look like this:

 <input type="checkbox" name="FeatureID" value="#FeatureID#">#Feature# <br>  

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1