I have table called products, i have two fields pro_id, name.
Now I got all the data from this table into table format and now i want to add a chexbox in the last column of every rows, when i select the check box and click on submit.
my output should be in another php file where i shoule get all the contnet which i checked in the table format
--------------------------
pro id Name checked
--------------------------
1 abc yes
2 xyz no
3 mno yes
my output should be
--------------------------
pro id Name checked
--------------------------
1 abc yes
3 mno yes
please help
php-mysql
Moderator: General Moderators
Re: php-mysql
hi msvasu,
not entirely sure what it is you are trying to do... could you perhaps share the code that you are having trouble with?
from what I gather, what you want to do is change your MySQL query to something like:
if that helps, great! if not, please elaborate!
not entirely sure what it is you are trying to do... could you perhaps share the code that you are having trouble with?
from what I gather, what you want to do is change your MySQL query to something like:
Code: Select all
$query = "SELECT * FROM products WHERE checked = 'yes'";Re: php-mysql
If I'm understanding you right, an easy solution would be to use an array inside the form. Example:
The form's action goes to the other page you mentioned, where you can just loop through $_POST['proid'] and do whatever you need to do.
Code: Select all
<input type="checkbox" name="proid[]" value="<?php echo $row['pro_id']; ?>" />