Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How do I use a confirmation button to delete a record(click to runs code below)
Old 02-15-2009, 05:51 PM How do I use a confirmation button to delete a record(click to runs code below)
Novice Talker

Posts: 7
Name: Fazil Baksh
Location: Ottawa, Canada
Trades: 0
PHP Code:
<?php
$CID 
$_GET['CID'];
$con mysql_connect("mysqlhost.netfirms.com:3306","uxxxxxxx","abxxx");
if (!
$con)
 {
  die(
'Could not connect: ' mysql_error());
 }
mysql_select_db("database"$con);
mysql_query("DELETE FROM mypersonalcontacts WHERE CID='$CID'");
echo 
"Record No.$CID was DELETED";
mysql_close();
?>
hummingbird is offline
Reply With Quote
View Public Profile Visit hummingbird's homepage!
 
 
Register now for full access!
Old 02-15-2009, 06:02 PM Re: How do I use a confirmation button to delete a record(click to runs code below)
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Try this,

PHP Code:
<?php
$CID 
$_GET['CID'];
if(
$_GET['confirmed'] === 'yes'){
$con mysql_connect("mysqlhost.netfirms.com:3306","uxxxxxxx","abxxx");
if (!
$con)
 {
  die(
'Could not connect: ' mysql_error());
 }
mysql_select_db("database"$con);
mysql_query("DELETE FROM mypersonalcontacts WHERE CID='$CID'");
echo 
"Record No.$CID was DELETED";
mysql_close();
} else {
?>
<a href="?CID=<?php echo $CID;?>&confirmed=yes">Are you sure?</a>
<?php
}
?>
It makes the user confirm they want to delete it with an extra link.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE

Last edited by rogem002; 02-15-2009 at 06:04 PM..
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 02-15-2009, 09:10 PM Re: How do I use a confirmation button to delete a record(click to runs code below)
Novice Talker

Posts: 7
Name: Fazil Baksh
Location: Ottawa, Canada
Trades: 0
Thank you very much. It's exactly what i wanted.
hummingbird is offline
Reply With Quote
View Public Profile Visit hummingbird's homepage!
 
Reply     « Reply to How do I use a confirmation button to delete a record(click to runs code below)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24473 seconds with 12 queries