Gazz1982 Posted June 8, 2008 Share Posted June 8, 2008 my database: +------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-------------+------+-----+---------+----------------+ | ID | int(11) | NO | PRI | NULL | auto_increment | | EMAIL | varchar(30) | NO | | NULL | | | PASSWORD | varchar(30) | NO | | NULL | | | NAME_FIRST | char(20) | YES | | NULL | | | NAME_LAST | char(20) | YES | | NULL | | | COMPANY | char(20) | YES | | NULL | | | ADDRESS1 | varchar(20) | YES | | NULL | | | ADDRESS2 | varchar(20) | YES | | NULL | | | ADDRESS3 | varchar(20) | YES | | NULL | | | COUNTY | char(20) | YES | | NULL | | | COUNTRY | char(20) | YES | | NULL | | | POST_CODE | varchar( | YES | | NULL | | | PHONE | varchar(30) | YES | | NULL | | | DISPOSE | char(3) | YES | | NULL | | +------------+-------------+------+-----+---------+----------------+ 14 rows in set (0.01 sec) this is displayed in a php generated table, I have added a checkbox to each row in the table - how do I make it so that when this check box is ticked it adds 'yes' into the dispose column of that row? Is this possible? Link to comment https://forums.phpfreaks.com/topic/109266-using-php-tables-and-interacting/ Share on other sites More sharing options...
MiCR0 Posted June 8, 2008 Share Posted June 8, 2008 Ajax or JS Link to comment https://forums.phpfreaks.com/topic/109266-using-php-tables-and-interacting/#findComment-560459 Share on other sites More sharing options...
Gazz1982 Posted June 8, 2008 Author Share Posted June 8, 2008 im using php - would i need to use javascript with it? Link to comment https://forums.phpfreaks.com/topic/109266-using-php-tables-and-interacting/#findComment-560461 Share on other sites More sharing options...
GingerRobot Posted June 8, 2008 Share Posted June 8, 2008 Without realoading the page? Yeah, you'll need to use AJAX techniques. If you're happy to have a reload then you'll want to name your checkbox as an array with the value of the checkbox as the ID of the row. You can then implode the array and use IN in your update statement. Something like: $ids = implode(',',$_POST['checkboxes']; //assuming ID is numerical. Otherwise, you'll need to add quotes around each ID too. $sql = "UPDATE yourtable SET DISPOSE = 'yes' WHERE ID IN ($ids)"; Link to comment https://forums.phpfreaks.com/topic/109266-using-php-tables-and-interacting/#findComment-560462 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.