I have a similar issue with this code:

//Läsa in rätter för att kunna radera de oönskade via checkbox..
function ReadProductsForEdit($ratter){
$link = mysql_connect("localhost", "fruit", "potatoe");
mysql_select_db("db");
$result = mysql_query("SELECT * FROM meny");
	echo '<form method="post" action="iframe_index.php">';
	echo '<br><br><table width="500px">';
	echo '<tr><td class="nr"><b>Nr</b></td><td class="ratt"><b>Rätt</b></td><td class="beskr"><b>Beskrivning</b></td></tr>';
	while ($row = mysql_fetch_array($result)){
		echo '<tr><td class="nr">'."$row[nr]".'</td>';
		echo '<td class="ratt">'."$row[ratt]".'</td>';
		echo '<td class="beskr">'."$row[beskr]".'</td>';
		echo '<td><input type="checkbox" name="checkbox[]" id="checkbox[]" value="'."$row[nr]".'"></td></tr>';	
	}
	echo '</table><br><br>';
	echo '<br /><br /><input name="delete" type="submit" id="delete" value="Delete">';
	echo '</form>';
	// Check if delete button active, start this
if($delete){
for($i=0;$i<$count;$i++){
$del_id = $checkbox[$i];
$sql = "DELETE FROM $meny WHERE nr='$del_nr'";
$result = mysql_query($sql);
}
// if successful redirect to delete_multiple.php
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=iframe_index.php\">";
}
}
mysql_free_result ($result);
mysql_close($link);	
}

Recommended Answers

All 2 Replies

Please clarify exactly what you are having trouble with.

commented: That was incredibly polite of you +13

I want to be able to delete the rows (from db) where the checkboxes are checked but when clicking on "Delete" button it only refreshes the page?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.