Jump to content

delete function


angelsRock

Recommended Posts

 

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

THATS JAVA SCRIPT  not php ;D

 

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.