[eluser]Hana[/eluser]
Hello everyone
I am trying to create a PHP form. I did a query on a database (in my Model), and I display the results in the view with a foreach.
Then, my user can choose which objects he wants to disable and which objects he wants to exclude from the list.
My problem is I don't get How to create a table disable[] and exclude[] containing every line where "disable" is chosen and "exclude" is chosen.
I'm lost :down:
Here is my code (or what I'm trying...)
Code:
<?php
echo form_open('adm/disableObsolete',$attributs);
foreach($Users as $index=>$item)
{
echo " <tr>
<td><select name='DN[]' value='".$item[0]."'>
<option value='donothing'> </option>
<option value='disable'>Disable</option>
<option value='exclude'>Exclude</option>
</select></td>
<td>".$item[2]."</td>
<td>".$item[3]."</td>
<td>".$item[4]."</td>
<td>".date_format($item[5], "Y/m/d h:m:s")."</td>
<td>".$item[6]."</td>
<td>".$item[7]."</td>
<td>".$item[8]."</td>
<td>".date_format($item[9], "Y/m/d h:m:s")."</td>
<td>".$item[0]."</td>
<td>".$item[1]."</td>
</tr>";
}
?>
</tbody>
</table>
<input type="submit" value="Disable and Exclude selected objects" name="submit" /></div>
After this, I am trying in my Controller to display each $item[0] value from disable[] and each $item[0] value from exclude[].
Then I will do a request on each objects to disable and another request on each objects to exclude, in the same fonction. (foreach exclude do this) (foreach disable do this)
Code:
$disable = (($_POST['DN'][] = 'disable'));
print_r($disable);
Something like this ?
If you have any ideas which could help me it would be great! I'm desperate and I found only simple form on the web... No tips on form like mine :o
Thanks! :-)
Edit: It seems I cannot do what I want with the "select option" component... Then, I could do this:
On the left, checkbox and one button (input) "Disable selected objects". And on the right, another pool of checkbox and its button "Exclude selected objects".
I don't want to use radiobutton because if the user clicks on the button it can't uncheck it anymore >_<
So, I should try 1 form with 2 pool of checkboxes ? ^^