PHP gevorderde |
|
<html>
<head>
<title>Admin Gastenboek 'Delete'</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="layout.css">
</head>
<body>
<?php
require_once('connect.php');
$query = "SELECT * FROM gastenboek ORDER BY id DESC";
$sql=mysql_query($query) or die (mysql_error());
while ($obj=mysql_fetch_object($sql)) {
$id = $obj->id;
$door = $obj->door;
$datum = $obj->datum;
$email = $obj->email;
$bericht = $obj->bericht;
?>
<table>
<tr>
<th>ID: </th>
<td><?php echo $id; ?></td>
</tr>
<tr>
<th>Naam: </th>
<td><?php echo $door; ?></td>
<tr>
<th>Datum: </th>
<td><?php echo $datum ?></td>
</tr>
<tr>
<th>Email: </th>
<td><a href="mailto:<?php echo $email ?>"><?php echo $email ?></a></td>
</tr>
<tr>
<th>Bericht: </th>
<td><?php echo $bericht; ?></td>
</tr>
</table>
<?php } ?>
<?php
require_once('connect.php');
$idnum=$_POST['idnum'];
if(isset($idnum))
{
mysql_query("DELETE FROM gastenboek WHERE id='$idnum'");
}
?>
<table>
<form action="" method="post">
<tr>
<th width="33%">Delete: </th>
<td width="33%"><input type="text" name="idnum" /></td>
<td width="33%"><input type="submit" value="Verzend" /></td>
</tr>
</form>
</table>
</body>
</html>
<html> <head> <title>Admin Gastenboek 'Delete'</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="layout.css"> </head> <body> <?php require_once('connect.php'); $query = "SELECT * FROM gastenboek ORDER BY id DESC"; $id = $obj->id; $door = $obj->door; $datum = $obj->datum; $email = $obj->email; $bericht = $obj->bericht; ?> <table> <tr> <th>ID: </th> <td> <?php echo $id; ?></td> </tr> <tr> <th>Naam: </th> <td> <?php echo $door; ?></td> <tr> <th>Datum: </th> <td> <?php echo $datum ?></td> </tr> <tr> <th>Email: </th> <td><a href="mailto: <?php echo $email ?>"> <?php echo $email ?></a></td> </tr> <tr> <th>Bericht: </th> <td> <?php echo $bericht; ?></td> </tr> </table> <?php } ?> <?php require_once('connect.php'); $idnum=$_POST['idnum']; { mysql_query("DELETE FROM gastenboek WHERE id='$idnum'"); } ?> <table> <form action="" method="post"> <tr> <th width="33%">Delete: </th> <td width="33%"><input type="text" name="idnum" /></td> <td width="33%"><input type="submit" value="Verzend" /></td> </tr> </form> </table> </body> </html>
Hier is mijn code van mijn admin. mijn inlogscript heb ik er even uitgelaten want dat werkt juist
Maar ik kan niet deleten weet niet hoe dat het komt.
Kan iemand even helpen?
Maarten
Geen fout niet meer
|