473,382 Members | 1,238 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

how to pop up " confirm delete box" when user click delete?

hi

now i would like user to delete what they don;t want to buy after they already put it in shopping cart. i would like to have a pop up box to alert users that they are going to delete what they put in shopping cart. if they click "yes" then it will proceed to delete the item. if they click "no" , then it will not execute delete action. this is to prevent user to accidently delete the item.

i am not sure how should i do it. can anyone give me some ideas?

thanks
Jul 8 '07 #1
1 5752
ak1dnar
1,584 Expert 1GB
This is a PHP and JS solution.Try it by your self.
Thanks!
-Ajaxrand


Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if (isset($_GET['action']) && isset($_GET['record']) ) 
  3. {
  4.     $RecordId = htmlspecialchars($_GET['record']);
  5.     $Action = htmlspecialchars($_GET['action']);
  6.     if($Action=='deleteRecord'){
  7.     echo 'You are ready to delete ID: '.$RecordId;
  8.     #
  9.     # CODE for delete records
  10.     #
  11.     }
  12.  
  13. }
  14. ?>
  15. <html>
  16. <head>
  17. <script language="javascript" type="text/javascript">
  18. function deleteRecord(RecordId)
  19. {
  20.     if (confirm('Delete this Record?')) {
  21.         window.location.href = 'index.php?action=deleteRecord&record=' + RecordId;
  22.     }
  23. }
  24. </script>
  25. </head>
  26.  
  27. <body>
  28. <br>
  29. Item 1 <a href="javascript:deleteRecord('1001');">DELETE
  30.  
  31. Item 3<a href="javascript:deleteRecord('1003');">DELETE
  32.  
  33. Item 15 <a href="javascript:deleteRecord('1015');">DELETE
  34.  
  35. </body>
  36. </html>
  37.  
Jul 8 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Nige | last post by:
Is it possible to create an alert box when a radio button is selected? I have a group of three, and I want a different alert for each one. -- Nige Please replace YYYY with the current year...
2
by: Spongebob | last post by:
Hello! I tried to use this code from Peter Torr: Foo.Attributes("onclick") = "if (confirm('delete?') == false) return false; " + Foo.Attributes("onclick") It works nomral on IE5, Windows...
0
by: JT | last post by:
In looking around on the internet to find out how to use a "messagebox"-like window on a webform, I have come across a few examples of how to do so from the "onclick" event of a button. In my...
6
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
I want to implement the following: If the user clicks on the border of a form, then I want to show a box around the form that represents the form's bounds. As the user moves the mouse only the...
7
by: kang jia | last post by:
hi currently, i would like to do a "confirm delete dialog box" , before user really decide to delete. so when user click delete, dialog box will pop up , saying "confirm delete ?" if yes, then go...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.