views:

24

answers:

2

Hi, im trying to build a simple app:

  • Six colums with these values

Nr, Name, checkbox 1, checkbox 2, checkbox 3, checkbox 4.

The checkboxes are project stages, Im using Mysql to store the data and retrieving it to a webpage with php.

My problem is on how to go updating the checkboxes, and also how to filter the results (display only records with checkbox 1 checked).

Or can anyone recommend other solutions/platforms?

This is not overly complex I thought someone must knew a better or easier way to do this.

Thanks

A: 

After your sql query, something like this would work:

if($row['checkbox1'])
    echo "<INPUT TYPE=CHECKBOX NAME=checkbox1 CHECKED>";
else
    echo "<INPUT TYPE=CHECKBOX NAME=checkbox1>";

Query for filtering:

select * from table where checkbox1 = 1;
Trevor
Since I dont know the names before hand for the check boxes I would need to loop trough all of them using another field like ID for each row on the table?
Marvin
A: 
<input type='checkbox' name='aname' value='avalue' <?php
       if(isChecked($dbrow, $itemname)) // you write this function
       {
          echo "checked='checked'";
       } 
?>/>
Ewan Todd