I can get the message to delete when you attempt to load that page, but I don’t want this – i want a button that you click that will delete that message, anyone know how this is done?
@scragarFeb 04.2005 — #[code=php] <? if(isset($_GET['del'])){//they want to delete. $sql = "DELETE FROM pms WHERE To = ".$User." AND ID = ".$_GET['del']; mysql_query($sql); };[/code]
[code=php]<? if(isset($_GET['del'])){//they want to delete. $sql = "DELETE FROM pms WHERE To = ".$User." AND ID = ".$_GET['del']; mysql_query($sql); };
?>
<a href="?del=<? echo $CurrPM ?>">Delete this PM</a>[/code]
@MstrBobFeb 05.2005 — #[font=trebuchet ms][COLOR=royalblue]But you are passing a get variable. It won't delete the PM unless that variable is called, and that's how most systems do it. If you're looking to avoid refreshing the page, you can use Javascript to call a PHP page, but that's unneccessary, I feel, unless you've a real good reason to do so. So, you can have pm.php load, but if they click a link to pm.php?del, then it will delete the PM, should work just fine. The alternative, if you insist, would be to have a form POST the information, and check to see if the POST data is available, and if it is, delete the PM.[/COLOR][/font]
@JonaFeb 05.2005 — #[font=trebuchet ms]He seems to be looking for a JavaScript method to delete a PM automatically. This cannot be done without an XMLHttpRequest (which does not work in all browsers). Your best and most accessible way would be to use PHP exclusively. You will always have to reload the page for PHP to get the query - you can't use JavaScript to delete a PM without reloading the page. Well, you can in theory, but I for one wouldn't do that for anyone -- not for free. I would consider other options.[/font]