ComputerForum.com ComputerForum.com  
TigerDirect
 
Go Back   Computer Forum > Computer Software > General Software

Reply
 
LinkBack Thread Tools Display Modes
Old 02-08-2008, 02:16 PM   #1 (permalink)
Diamond Member
 
Join Date: May 2005
Location: here
Age: 22
Posts: 1,017
Default Multiple checkboxes

Hello all,
I'd multiple checkboxs and radio buttons , and they are generated automatically based on the database that I'd (mysql)..

on my page, I had queried all the questions and number of options, part of the code that I think you need is:

for($i=1;$i<=$NbOptions;$i++)
{
if($MultiAnswer == 'yes')
{
echo "<input type='checkbox' name='box[]' value='$idQuestion_$i' />" . $row2['option'.$i];
echo "<br />";
}

else
{
echo "<input type='radio' name='box[]' value='' />" . $row2['option'.$i];
echo "<br />";
}


}

when I press save ,
I use
if(isset($_POST['save']))

//here I want to loop through all the box[]?
and see if its checked or no
__________________
TechNoloGy ConTrols tHe World
AnD I conTroL the TecHnOl0gy
Gue$s WhO @m i.
HehEhehee :confused:
houssam_ballout is offline   Reply With Quote


Old 02-08-2008, 04:33 PM   #2 (permalink)
Moderator
 
Cromewell's Avatar
 
Join Date: Dec 2004
Location: Canada
Age: 25
Posts: 10,115
Default

So you are looking for how to loop though it?

I think you'd want to do something like this:
Code:
for ($i = 0; $i < count($_POST['box']; $i++){
  if (isset($_POST['box'][$i])){
    //do stuff
  }
}
__________________

You know what the chain of command is? It's the chain I go get and beat you with 'til ya understand who's in ruttin' command here.

I must plug a couple comics because they are good :D:
www.ctrlaltdel-online.com
www.userfriendly.org
Cromewell is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Renaming multiple files in windows explorer PC Hobbyist General Software 5 02-06-2007 12:45 PM
Multiple problems with multiple games?!?!? audiobahn1000 General Software 3 08-21-2006 12:07 PM
Multiple problems with multiple games?!?! audiobahn1000 General Software 0 08-21-2006 09:22 AM
Multiple problems with multiple games?!?! audiobahn1000 General Software 0 08-21-2006 09:21 AM
Multiple image resizing software tobywuk General Software 1 06-18-2006 08:25 PM



All times are GMT +1. The time now is 05:44 PM.


Powered by: vBulletin Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Copyright © 2002-2007 Computer Forum and Web Design Forum