Autor Zpráva
sinnerman
Profil
Zdravím všetkých!

Som v PHP novice a potreboval by som pomôcť s vymazávaním z mysql pomocou checkboxu... Poväčšinu vecí som robil v Dreamweaver-y a potom niečo pohľadal na fórach.
formular:
<form action="db/delete.php" method="post" name="form1">

<table border="1">
<tr>
<td width="88" class="table_head">bid</td>
<td width="105" class="table_head">sluzby</td>
<td width="96" class="table_head">9x13</td>
<td width="102" class="table_head">10x15</td>
<td width="102" class="table_head">13x18</td>
<td width="104" class="table_head">15x20</td>
<td width="103" class="table_head">18x25</td>
<td width="107" class="table_head">20x30</td>
<td width="105" class="table_head">25x30</td>
<td width="105" class="table_head">25x38</td>
<td width="107" class="table_head">30x40</td>
<td width="105" class="table_head">30x45</td>
</tr>
<?php do { ?>
<tr>
<td class="table_content"><!-- <a href="?view=db/edit.php"> -->
<?PHP $bid = $row_sluzby_st['bid'] ?><?php echo "<a href=\"" . htmlspecialchars("?view=db/edit.php&bid=" . urlencode($bid)) . "\">\n"; ?>
<?php echo $row_sluzby_st['bid']; ?></a></td>
<td class="table_content"><?php echo $row_sluzby_st['sluzby']; ?></td>
<td class="table_content"><?php echo $row_sluzby_st['9x13']; ?></td>
<td class="table_content"><?php echo $row_sluzby_st['10x15']; ?></td>
<td class="table_content"><?php echo $row_sluzby_st['13x18']; ?></td>
<td class="table_content"><?php echo $row_sluzby_st['15x20']; ?></td>
<td class="table_content"><?php echo $row_sluzby_st['18x25']; ?></td>
<td class="table_content"><?php echo $row_sluzby_st['20x30']; ?></td>
<td class="table_content"><?php echo $row_sluzby_st['25x30']; ?></td>
<td class="table_content"><?php echo $row_sluzby_st['25x38']; ?></td>
<td class="table_content"><?php echo $row_sluzby_st['30x40']; ?></td>
<td class="table_content"><?php echo $row_sluzby_st['30x45']; ?></td>
<?php $vyber=mysql_query("select * from cennik where bid='$bid'");
$ii=0;
while ($riadok=mysql_fetch_array($vyber))
{
$ii++;
echo "<td class=\"table_content\"> <input type=\"checkbox\" name=\"delete[$ii]\" value=\"$riadok[$bid]\"> </td>";
}
$_POST['$riadok'][ii];
?>
</tr>
<?php } while ($row_sluzby_st = mysql_fetch_assoc($sluzby_st)); ?>
</table>

<!-- <input name="delete" type="checkbox" class="checkbox" id="delete" value="checkbox" /> -->

<p>
<input name="add" type="button" id="add" onclick="window.location='index.php?view=db/add_st.php'" value="Pridať" />
<input name="del_btn" type="submit" id="del_btn" value="Vymazať" />
</p>
</form>


a v delete.php mám toto:

<?php

$riadok=array($_GET['$vyber']);
$del_item =implode(",",$riadok);
mysql_query("DELETE FROM cennik WHERE bid IN ($del_item)") /* or die(mysql_error()) */;
echo "<html><head><meta HTTP-EQUIV=\"Refresh\" CONTENT=\"1; URL=../index.php?view=db/sluzby_st.php\"></html>";
?>



Ďakujem.

Gabo.
Toto téma je uzamčeno. Odpověď nelze zaslat.

0