Forum Moderators: coopster

Message Too Old, No Replies

simple checkbox question

not complex whatsoever

         

bobnew32

11:02 pm on Dec 7, 2003 (gmt 0)

10+ Year Member



Well i've been searching over the forums and web, and can't find a short answer to my question.

I have an input checkbox for banning members. A page displays the members i want to ban:

<input type=checkbox name="user_ids[]" value="">

(The value would be any int number)

On the page that accepts the data, all I want to do is create a new row for each input box checked. I'm guessing I would have to put it in an array of somesort? Plz help this simple question. THx

coopster

2:15 am on Dec 8, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>>On the page that accepts the data, all I want to do is create a new row for each input box checked.

Are you saying that you want to create a new row in a database table for each box checked? Have you checked out this thread yet? It is specifically using checkboxes:

Using a form to retrieve data from a MySQL database [webmasterworld.com]?

bobnew32

3:55 am on Dec 8, 2003 (gmt 0)

10+ Year Member



Actually, I still don't understand most of that stuff; I don't even need for it to be adding a row into a database, all I need is a while or for each simply to be created from the data of the checkboxes.

$sql= "select * from table";
$result= mysql_query($sql);
while($row= mysql_fetch_array($result))
{

}

SOmthing like that, but with the data coming from the checkboxes, not from a database.


EDIT: NVM, i found it myself :)

foreach ($_POST['user_ids'] as $i)
{

}