Okay I have this code for the admin panel for my guestbook....
Basically what it outputs is for each entry the following in a table...
[ ] Name Email WEbsite Comment
[ ] Name Email WEbsite Comment
[ ] Name Email WEbsite Comment
etc.
(( I bolded what I called the checkboxes in the code. ))
when i submit what is the best way to basically say
if checked = true then {sql$="DELETE from Guestbook WHERE name=$name, email=$email, website=$website', comment=$comment
What is the best way to do this, I can't seem to find this anywhere on the 'net...
The table's columns are as such
Guestbook
IDNO
Name
email
website
comments
_________________
here's the code:
<html><body>
<?php
//link db begin
$a=0;
$link = mysql_connect('xxx', 'xxx', 'xxx')
or die('Could not connect: ' . mysql_error());
mysql_select_db(xxx) or die('Could not select database');
//link db end
//actual code begin
$query2 = "SELECT * FROM Guestbook";
$result = mysql_query($query2) or die('Query failed: ' . mysql_error());
Echo "<table border cellpadding=3>";
?><form method="POST" action="adminb.php"> <?
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
Echo "\n\n\n<table border cellpadding=0>";
Echo "<tr><Td>";
$a++;
echo "<input type=\"checkbox\" name=\"admin[]\">";
echo "</td><td width=25>Name:</td><td width=250>".$line['name']."</td>";
Echo "<td>E-Mail:</td><td>".$line['email']."</td>";
Echo "<td>Website:</td><td>".$line['website']."</td>";
Echo "<td>Comment:</td><td>".$line['comment']."</td></tr></table>\n\n\n<br>";
}//actual code end
?>
<input type="submit" value="submit" name="submit">
</body></html>
Basically what it outputs is for each entry the following in a table...
[ ] Name Email WEbsite Comment
[ ] Name Email WEbsite Comment
[ ] Name Email WEbsite Comment
etc.
(( I bolded what I called the checkboxes in the code. ))
when i submit what is the best way to basically say
if checked = true then {sql$="DELETE from Guestbook WHERE name=$name, email=$email, website=$website', comment=$comment
What is the best way to do this, I can't seem to find this anywhere on the 'net...
The table's columns are as such
Guestbook
IDNO
Name
website
comments
_________________
here's the code:
<html><body>
<?php
//link db begin
$a=0;
$link = mysql_connect('xxx', 'xxx', 'xxx')
or die('Could not connect: ' . mysql_error());
mysql_select_db(xxx) or die('Could not select database');
//link db end
//actual code begin
$query2 = "SELECT * FROM Guestbook";
$result = mysql_query($query2) or die('Query failed: ' . mysql_error());
Echo "<table border cellpadding=3>";
?><form method="POST" action="adminb.php"> <?
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
Echo "\n\n\n<table border cellpadding=0>";
Echo "<tr><Td>";
$a++;
echo "<input type=\"checkbox\" name=\"admin[]\">";
echo "</td><td width=25>Name:</td><td width=250>".$line['name']."</td>";
Echo "<td>E-Mail:</td><td>".$line['email']."</td>";
Echo "<td>Website:</td><td>".$line['website']."</td>";
Echo "<td>Comment:</td><td>".$line['comment']."</td></tr></table>\n\n\n<br>";
}//actual code end
?>
<input type="submit" value="submit" name="submit">
</body></html>