I just cant work these out:
First, I have my admin section of a guestbook, to delete unwanted messages.
When i click the delete this message button, I want a popup box to confirm the action, so if i change my mind, i can click cancel, or yes to confirm delete, I have bene using loads of scripts, and cant get any working, they just have page errors, or just link back to the guestbook main page....
this is my echo code:
echo "<title>Maleko: Online ::::Guest_Book_Admin::::</title><link href='style.css' rel='stylesheet' type='text/css'>
<table width='50%' border='0' align='center' cellpadding='0'cellspacing='0'>
<tr>
<td><img src='images/top.gif' width='100%' height='10' alt=''></td>
</tr>
<tr>
<td>
<table width='100%' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td width='1' bgcolor='#000000'></td>
<td width='475'><table width='100%' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td><font size='1' face='verdana,arial'>Posted by:
<font size='1' face='verdana,arial'>$name on $date</font></font></td>
</tr>
<tr>
<td><font size='1' face='verdana,arial'>$message</font><br>
<br>
</td>
</tr>
<tr>
<td>
<div align='right'>
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td><font size='1' face='Verdana, Arial, Helvetica, sans-serif'>$url<a href='$url'></a></font></td>
<td><div align='right'><font size='1' face='Verdana, Arial, Helvetica, sans-serif'>
//heres the delete part, $delete links to the var: $delete = 'guestbook.php?gb=del&id=$id';
<a href='$delete'>Delete
this message</a></font></div></td>
</tr>
</table>
</div></td>
</tr>
</table>
</td>
<td width='1' bgcolor='#000000'></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src='images/bottomgb.gif' width='100%' height='10' alt=''></td>
</tr>
</table><br>"
;
I have tried putting javascript inside and outside the php...no luck, ive tried onclick codes, a form button with a form action, javascript....annoying me, the javascript just wont work inside the echo...what am i doing wrong?
Any ideas??
Also, secondly, I want to put the delete code in the same file as this...so i dont have to link to another file to delete the entry..how can i add it to the page? I did rea dsommit about actions??
all the code is:
mysql_query("DELETE FROM guestbook WHERE ID=$id");
Can anyone help? Its driving me mad!