Help with Javascript, Delete record from mysql using PHP

From: Date: Thu, 02 May 2002 18:14:16 +0000
Subject: Help with Javascript, Delete record from mysql using PHP
Groups: php.general 
Request: Send a blank email to php-general+get-95722@lists.php.net to get a copy of this message
Hi all, I am having a problem with getting this to work properly. When a user select DELETE I want an alert to pop up and say HEY YOUR DELETING THIS. This portion is working properly. If you hit CANCEL the desired effect takes place NOTHING. But if you really want to cancel this record, it bombs out. I am not sure where to put the coding for this. Any one habve a quick answer for this. I would greatley appreciate it. Thank you in advance. the variable $conf_id is where I am having the problem <html> <head> <script language="javascript"> function conf() { var x=confirm("Are you sure you want to DELETE this Entry ?") if (x) window.location("delete.php?id=$conf_id") else alert("No Deletions Made") } </script> </head> <? $db = mysql_pconnect("localhost", "uname", "upass"); mysql_select_db("distributor_db", $db); $result = mysql_query("SELECT * FROM main",$db); echo "<table width=95% border=1 align=center>"; echo "<tr><td width=22%><b>Company</b><td width=22%><b>Name</b><td width=22%><b>Email</b><td width=22%><b>Phone</b><td width=22% colspan=3><b><center>Options</center></b></tr>"; while ($myrow = mysql_fetch_array($result)) { $conf_id = $myrow["user_id"] echo "<tr><td>".$myrow["company"]."<td>".$myrow["fname"]." ".$myrow["lname"]."<td>".$myrow["email"]."<td>".$myrow["phone"]; echo "<td align=center><a href=\"view.php?id=".$myrow ["user_id"]."\">View</a>"; echo "<td align=center><a href=\"update.php?id=".$myrow ["user_id"]."\">Edit</a>"; echo "<td align=center><a href=javascript:onclick=conf ()>Delete</a>"; } echo "</table>"; ?> </html> Thank You <><><><><><><><><><><><><><><><> Daniel Negrón Lotus Notes Administrator / Developer KB Electronics, Inc. 954.346.4900x122 http://www.kbelectronics.com <><><><><><><><><><><><><><><><>

« previous php.general (#95722) next »