how to update mysql with inputs and checkboxes
Posted
by Ronnie Chester Lynwood
on Stack Overflow
See other posts from Stack Overflow
or by Ronnie Chester Lynwood
Published on 2010-04-01T23:22:13Z
Indexed on
2010/04/01
23:53 UTC
Read the original article
Hit count: 219
hi. with this code:
<?
if (isset($_POST['onay'])) {
foreach ($_POST['secilen'] as $zuha) {
$olay = mysql_query("update mp3 SET aktif = '1' WHERE id = '$zuha'");
}
if ($olay) {
echo "islem tamam";
exit;
}
}
?>
and with this form: (select * from mp3 aktif = '0')
<form name="form" method="post">
<input readonly type="text" name="id" value="<?=$haciosman['id']?>" />
<input type="text" name="baslik" value="<?=$haciosman['baslik']?>
<input type="checkbox" name="secilen[]" value="<?=$haciosman['id']?>">
<input type="submit" name="onay" value="Onayla" />
I can set "aktif to 1" for each row that i checked. but i want to update "baslik" too! how can i update each "baslik" with that php code?
© Stack Overflow or respective owner