Results 1 to 7 of 7

Thread: PHP checkbox : check the checkbox and select data from database

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2009
    Posts
    3

    Question PHP checkbox : check the checkbox and select data from database

    hello everyone...
    i'm php beginner and have a very low programming skills.

    i have some problem with the php checkbox function.
    how to select data from database where the data is from checkbox and display the data.
    for example: i select penang and beach from the checkbox, then data must be selected from database. lastly display the data.

    here is my php code and i dont know how to write the php code to select checkbox

    Code:
     <form name="menu" target="">
       <div id="booking1">
         <table width="258">
           <tr>
             <th align="left" bgcolor="#299ad4" scope="row">State</th>
             </tr>
           <tr>
             <th width="250" align="left" scope="row" bgcolor="#eff6ff"b><table width="250">
               <tr>
                 <td width="80" class="style6" bgcolor="#eff6ff"><span class="style5" >Perlis</span></td>
                 <td width="22" class="style6" bgcolor="#eff6ff"><strong>
                   <label>
                   <input name="c1" type="checkbox" id="c1" value="checkbox" />
                   </label>
                 </strong></td>
                 <td width="93" bgcolor="#eff6ff" class="style6"><span class="style5">Negeri Sembilan </span></td>
                 <td width="22" bgcolor="#eff6ff" class="style6"><input name="c7" type="checkbox" id="c7" value="checkbox" /></td>
               </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Kedah</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c2" type="checkbox" id="c2" value="checkbox" /></td>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Melaka</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c8" type="checkbox" id="c8" value="checkbox" /></td>
               </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Penang</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c3" type="checkbox" id="c3" value="checkbox" /></td>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Kelantan</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c9" type="checkbox" id="c9" value="checkbox" /></td>
               </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Perak</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c4" type="checkbox" id="c4" value="checkbox" /></td>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Terengganu</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c10" type="checkbox" id="c10" value="checkbox" /></td>
               </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Selangor</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c5" type="checkbox" id="c5" value="checkbox" /></td>
                 <td bgcolor="#eff6ff" class="style5">Pahang</td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c11" type="checkbox" id="c11" value="checkbox" /></td>
               </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Kuala Lumpur </span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c6" type="checkbox" id="c6" value="checkbox" /></td>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Melaka</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c12" type="checkbox" id="c12" value="checkbox" /></td>
               </tr>
             </table></th>
           </tr>
           <tr>
             <th align="left" scope="row">&nbsp;</th>
           </tr>
           <tr>
             <th align="left" bgcolor="#299ad4" scope="row">Place of Interest</th>
             </tr>
           <tr>
             <th align="left" scope="row"><table width="250">
               <tr>
                 <td width="119" bgcolor="#eff6ff" class="style6"><span class="style5">Beach</span></td>
                 <td width="29" bgcolor="#eff6ff" class="style6"><strong>
                   <label>
                   <input name="c13" type="checkbox" id="c13" value="checkbox" />
                   </label>
                 </strong></td>
                 </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Island</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c14" type="checkbox" id="c14" value="checkbox" /></td>
                 </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Lakeside</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c15" type="checkbox" id="c15" value="checkbox" /></td>
                 </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6">Riverside</td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c16" type="checkbox" id="c16" value="checkbox" /></td>
               </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Town/City</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c17" type="checkbox" id="c17" value="checkbox" /></td>
                 </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Outskirt</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c18" type="checkbox" id="c18" value="checkbox" /></td>
                 </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Highland/Hillside</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c19" type="checkbox" id="c19" value="checkbox" /></td>
               </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6">Theme Park</td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c20" type="checkbox" id="c20" value="checkbox" /></td>
               </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">National Park</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c21" type="checkbox" id="c21" value="checkbox" /></td>
               </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Golf Club </span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c22" type="checkbox" id="c22" value="checkbox" /></td>
                 </tr>
             </table></th>
             </tr>
           <tr>
             <th align="left" scope="row">&nbsp;</th>
           </tr>
           <tr>
             <th align="left" bgcolor="#299ad4" scope="row">Facilities</th>
             </tr>
           <tr>
             <th align="left" scope="row"><table width="250">
               <tr>
                 <td width="119" bgcolor="#eff6ff" class="style6"><span class="style5">Hotel</span></td>
                 <td width="29" bgcolor="#eff6ff" class="style6"><strong>
                   <label>
                   <input name="c23" type="checkbox" id="c23" value="checkbox" />
                   </label>
                 </strong></td>
               </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Resort</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c24" type="checkbox" id="c24" value="checkbox" /></td>
               </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Chalet</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c25" type="checkbox" id="c25" value="checkbox" /></td>
               </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Budget Hotel</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c26" type="checkbox" id="c26" value="checkbox" /></td>
               </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6"><span class="style5">Apartment</span></td>
                 <td bgcolor="#eff6ff" class="style6"><input name="c27" type="checkbox" id="c27" value="checkbox" /></td>
               </tr>
               <tr>
                 <td bgcolor="#eff6ff" class="style6">Hotel &amp; Spa </td>
                 <td bgcolor="#eff6ff" class="style6"><input name="cc28" type="checkbox" id="cc28" value="checkbox" /></td>
               </tr>
    
             </table></th>
             </tr>
           <tr>
             <th align="left" scope="row"><input type="submit" name="Submit" value="Submit" id="Submit" /></th>
           </tr>
           <tr>
             <th height="16" align="left" bgcolor="#299ad4" scope="row"><label for="Submit"></label></th>
             </tr>
         </table>
         </div>
    
      </form>
    Attached Images Attached Images  
    Last edited by mizz_aurora; Oct 25th, 2009 at 06:43 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width