0

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);	
}

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by secstr
1

Please clarify exactly what you are having trouble with.

Votes + Comments
That was incredibly polite of you
0

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?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.