angelsRock Posted October 25, 2007 Share Posted October 25, 2007 echo"<td align=center><a href='delete.php?prem77=$row[premPropertyID]'><font size=2 color='#666666'>".Delete."</font></a></td>"; in delete.php <?php if(isset($_GET[prem77])){ $connection=mysql_connect($server, $user, $pass); if(!$connection) die("Connection failed"); else { mysql_select_db($db); $query = "delete from prem_propertyad where premPropertyID = '".$_GET[prem77]."' "; $exec=mysql_query($query); echo '<script>alert("Property deleted");</script>'; echo '<script>window.location="myneuproperty-postings.php";</script>'; } }?> how do i add in the warning to prompt " Are u sure want to delete?" with yes or no button Link to comment https://forums.phpfreaks.com/topic/74685-delete-function/ Share on other sites More sharing options...
teng84 Posted October 25, 2007 Share Posted October 25, 2007 THATS JAVA SCRIPT not php try this simple sample <html> <head> <script type="text/javascript"> function disp_confirm() { var r=confirm("Press a button") if (r==true){ return true; } else { return false; } } </script> </head> <body> <a href="#" onClick="disp_confirm()">#</a> </body> </html> Link to comment https://forums.phpfreaks.com/topic/74685-delete-function/#findComment-377581 Share on other sites More sharing options...
darkfreaks Posted October 25, 2007 Share Posted October 25, 2007 on the delete button <input type="submit" value="Delete" onClick='if(submit ("Are you sure you want to delete this?")) return true; else return false;'> Link to comment https://forums.phpfreaks.com/topic/74685-delete-function/#findComment-377606 Share on other sites More sharing options...
angelsRock Posted October 25, 2007 Author Share Posted October 25, 2007 so how should i put this if(!$connection) die("Connection failed"); else { mysql_select_db($db); $query = "delete from prem_propertyad where premPropertyID = '".$_GET[prem77]."' "; $exec=mysql_query($query); echo '<script>alert("Property deleted");</script>'; echo '<script>window.location="myneuproperty-postings.php";</script>'; } Link to comment https://forums.phpfreaks.com/topic/74685-delete-function/#findComment-377607 Share on other sites More sharing options...
darkfreaks Posted October 25, 2007 Share Posted October 25, 2007 <?php if (!$exec) { /// stuff to do on false submit} else{ echo '<script>alert("Property deleted");</script>'; echo '<script>window.location="myneuproperty-postings.php";</script>';}?> Link to comment https://forums.phpfreaks.com/topic/74685-delete-function/#findComment-377608 Share on other sites More sharing options...
darkfreaks Posted October 25, 2007 Share Posted October 25, 2007 if you give me the full code i can implement it for you angel but all you really need is the following in your delete button <input type="submit" value="Delete" onClick='if(submit ("Are you sure you want to delete this?")) return ; else return false;'> Link to comment https://forums.phpfreaks.com/topic/74685-delete-function/#findComment-377609 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.