Delete script - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-03-2009, 01:48 AM   #1 (permalink)
Junior Member
 
Join Date: May 2009
Location: Hyderabad (India)
Posts: 12
Default Delete script

need help

In the delete script the delete option is working after twice or thrice button clicks and both delete and cancel buttons are working in the same action. But usually Cancel should not function as delete.

here is the php script

<?php
$link = mysql_connect("localhost", "root", "")
or die("Could not connect: " . mysql_error());
mysql_select_db('taskmangment', $link)
or die ( mysql_error());


switch ($_GET['action']) {
case "delete":
$sql = "DELETE FROM AddJob WHERE note_id='" . mysql_real_escape_string($_GET['id']) . "'";
$result = mysql_query($sql)
or die("Invalid query: " . mysql_error());
break;
default:
$note = "";
break;
}

?>
<html>
<head>
<title>Delete</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script type="text/javascript">
function RefreshParentWindow()
{
if (window.opener && !window.opener.closed)
{
window.opener.location.reload();
self.close();
}
}
</script>
</head>
<body>
<center>
Are you sure do you want delete this?
<form name="Form1" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
<input type="submit" name="SUBMIT" value="<?php echo $_GET['action'];?>" onClick="RefreshParentWindow()" >
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="SUBMIT" value="Cancel" onClick="RefreshParentWindow()" >
<?php
echo "
<input type='hidden' name='action' id='action' value='".$_GET['action']."' >
<input type='hidden' name='type' id='type' value='change' >
<input type='hidden' name='id' id='id' value='".$_GET['note_id']."' >";

?>

</form>
</center>
</body>
</html>

Please help me

Thanks.
jyothip is offline   Reply With Quote
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 07:44 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting