Nieuw lid |
|
Hallo,
Ik heb een form die een poll kan deleten.
Alleen er werkt 1 ding niet.
Je kunt de poll selecteren en daarna deleten.
Deze link naar delete.php alleen hij verwijderd hem niet en ik
zie de fout niet.
Kan iemand mij helpen?
Formulier
<HTML>
<Body>
<form action="delete.php">
<?php
$dbh=mysql_pconnect ("localhost", "user_", "w8woord") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("db_");
$sql = "SELECT * FROM poll";
$result = mysql_query($sql);
$endselect = "</SELECT>";
$select = "<SELECT name=\"poll_id\">";
echo ("".$select."");
$submit = "<BR><input type=\"submit\" value=\"Verwijder\">";
while ($row = mysql_fetch_array($result))
{
$option = "<option value=\"".$row[poll_id]."\" />".$row[poll_stelling]." - ID: ".$row[poll_id]."";
echo ("".$option."");
}
echo ("".$endselect."".$submit."");
?>
</form>
</Body>
</HTML>
<HTML> <Body> <form action="delete.php"> <?php $sql = "SELECT * FROM poll"; $endselect = "</SELECT>"; $select = "<SELECT name=\"poll_id\">"; $submit = "<BR><input type=\"submit\" value=\"Verwijder\">"; { $option = "<option value=\"".$row[poll_id]."\" />".$row[poll_stelling]." - ID: ".$row[poll_id].""; } echo ("".$endselect."".$submit.""); ?> </form> </Body> </HTML>
Delete.php
<?php
$dbh=mysql_pconnect ("localhost", "user_", "w8woord") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("db_");
$sql ="DELETE FROM poll WHERE poll_id = '$_POST[poll_id]'";
if (mysql_affected_rows() < 1) {
}
else if(mysql_affected_rows() == 1)
{
echo ("News Article Succesfully Deleted!"); }
?>
<?php $sql ="DELETE FROM poll WHERE poll_id = '$_POST[poll_id]'"; } { echo ("News Article Succesfully Deleted!"); } ?>
|