If I understand you correctly you want to do this:
mysql_query("UPDATE mp3
SET
aktif = '1',
baslik = '" . mysql_escape_string($_POST['baslik']) ."'
WHERE id = '$zuha'");
But this is similar to what you already have in your original question:
mysql_query("update mp3 set aktif = '1',
baslik = '$_POST[baslik]'
where id = '$_POST[id]'")
The only difference now is that you make the query in a loop and use a different ID variable.
My comments on your code in your original question stay the same. ( ;) )
P.S.: Introduced mysql_escape_string()
for a little security.
UPDATE: Ok I think I got your problem now. You basically want to create an input field collection for every entry in your database, something like this:
<form name="form" method="post">
<table>
<?php while($haciosman = ($query)):?>
<tr>
<td><input readonly type="text" name="id" value="<?=$haciosman['id']?>" /></td>
<td><input type="text" name="baslik[<?php echo $haciosman['id'] ?>]" value="<?=$haciosman['baslik']?> </td>
<td><input type="checkbox" name="secilen[]" value="<?=$haciosman['id']?>">
</tr>
<?php endwhile; ?>
</table>
<input type="submit" name="onay" value="Onayla" />
</form>
You just define another the names of the text fields as arrays baslik[$haciosman['id']]
, similar as you did for the checkboxes but this time you specify the array key which is the ID of the record.
Then you PHP code you can access this array ($_POST['baslik']
contains an array now) like this:
if (isset($_POST['onay'])) {
foreach ($_POST['secilen'] as $zuha) {
$olay = mysql_query("UPDATE mp3
SET
aktif = '1',
baslik = '" . mysql_escape_string($_POST['baslik'][$zuha]) ."'
WHERE id = '$zuha'");
}
}
UPDATE 2:
You should really read the official short introduction to forms, follow the links in this article and in general read the official documentation to get more insight in how to work with PHP.