Hi Just having trouble getting a simple on click warning to work due to problem with quotes when I echo a link with the onclick function. Is there an easy way to add a warning for these delete links? Here is the delete.php pages code without the onclick fuction. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Delete Page - Dual Controls Car Contol Panel</title> <link href="cp_css/loginmodule.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Delete Form</h1> <p><a href="/dual_control_car_hire/control_panel">Control Panel</a></p> <ul> <?php //If cmd has not been initialized if(!isset($cmd)) { //display all the cars $result = mysql_query("select * from data order by make, model"); //run the while loop that grabs all the cars scripts while($r=mysql_fetch_array($result)) { //grab the make, model and the ID $make=$r['make']; $model=$r['model']; $id=$r['id']; //make the title a link echo "<li>"; echo "<a href='delete.php?cmd=delete&id=$id'>Delete - $make $model</a>"; echo "</li>"; } } ?> <? if($_GET["cmd"]=="delete") { $id = $_GET['id']; $sql = "DELETE FROM data WHERE id=$id"; $result = mysql_query($sql); echo "Row deleted!"; } ?> </body> </html> PHP:
echo "<a href='delete.php?cmd=delete&id=$id' onclick='return confirm(\"Delete this message?\")'>Delete - $make $model</a>"; Code (markup):