OK I set up a form which should let you delete entried from a database.
now the page fetches the content of the databse and using a radio button the user should be able to choose which one he wants to delete. But after choosing and pressing "submit" nothing happens. there is no error that appears, but I found out that actually the data never arrives the other scripts, which actually deletes the content. what is wrong? what do I have to change?
the form script:
<form action="delete_news.php" method="POST">
<?
$username="xxxxx";
$password="xxxxx";
$database="xxxxx";
mysql_connect(localhost,$username,$password);
mysql_select_db($database) or die( "Unable to select database");
$result = mysql_query("select * from features order by date desc limit 6") or die ("could not read news database");
while ($row = mysql_fetch_array($result))
{
print '<table border="0"><tr><td rowspan="2" valign="top">';
print '</td width="50"><input type="radio" name="choose" value="$id">';
print $row["id"];
print '<a href="' .$row["url"]. '" target="_blank"><img src="' .$row["picture_name"] . '" width="125" height="65" border="0"></a>';
print "</td>";
print '<td width="10" rowspan="2" valign="top">';
print "</td>";
print '<td width="500" height="10" valign="top"><font face="Arial" size="2"><b>';
print $row["title"];
print '</font></b></td><tr><td width="500" height="40" valign="top"><font face="Arial" size="2">';
print $row["text"];
print "</font></td><tr></table>";
mysql_free_result($result);
}
mysql_close();
?>
<input type="submit" value="Change Selected" /></form>
then the "delete" script:
<?
if ($choose)
{
echo "$id";
echo "$title";
echo " you did choose";
$username="xxxxx";
$password="xxxxx";
$database="xxxxx";
echo mysql_error();
mysql_connect(localhost,$username,$password);
mysql_select_db($database) or die( "Unable to select database");
$query = "delete from features where id='$choose';";
echo mysql_error();
mysql_query($query);
echo mysql_error();
mysql_close();
}
else
echo "you did not choose";
?>