Hi All,
Happy Monday!
I want to show the fields of each table in my DB as checkboxes in a user form that user can check and my program selects the column data from the DB depeneding on checked boxes.
e.g.
Table 1
fields as checkboxes
Table 2
fields as checkboxes
How do I get the info about the checked fields in each of the tables?
I hope it's clear enough.
Thank you all.
lkj
help with checkboxes (multidimensional array) in HTML forms
Moderator: General Moderators
hi - I assume u know how to connect to the database and pull info from it, so all u need is a loop to display the info in the DB and a form as checkboxes to accomodate the info... simple:
Now this will display the table and when checked, will send to delete.php (like on mine I have it so I can delete msgs of the checkboxed items displayed in my table.. u can modify the code to whateevr u like
and so u know, delete[] will make the data that is checked into a array so u can pass multiple variiables..
What did u want done with the data in the db anyway? edit them, delete them?
Code: Select all
<?php
$sql = "select * from table_name order by id";
//I assume u have a ID field in your DB so each field has its own idenification key
$result = mysql_query($sql);
$id = $row["id"];
while ($row = mysql_fetch_array($result)) {
echo "<form action=delete.php$delete POST><input type=checkbox name=delete[] value=$id> delete whatever";
//now on delete.php
if(isset($delete)) {
run whatever u want here
}
?>and so u know, delete[] will make the data that is checked into a array so u can pass multiple variiables..
What did u want done with the data in the db anyway? edit them, delete them?