adding delete confirmation

M

Mike Brearley

How would I add a delete confirmation popup box for the following?

Here's what I have... A table (not a form) that contains this line:

<td align="center"><a
href="delete.asp?username=<%=rsUsers("username")%>&startletter=<%=startlette
r%>">Delete user</a></td>

And delete.asp looks like this...

----------------------------------------------
<%
Option Explicit
Dim username,rsDelete,startletter

startletter = Request.QueryString("startletter")

if Session("fewmetadminlogin") = "True" then

username = Request.QueryString("username")
%>
<!--#include file="../includes/conn.asp"-->
<%
set rsDelete = conn.Execute("DELETE * FROM users WHERE username = '" &
username & "'")

conn.close
set conn = nothing
end if

Response.Redirect("default.asp?startletter=" & startletter)
%>

---------------------------------------------

--
Posted 'as is'. If there are any spelling and/or grammar mistakes, they
were a direct result of my fingers and brain not being synchronized or my
lack of caffeine.

Mike Brearley
 
C

CJM

You can either do something in Javascript (in which post a question in
microsoft.public.scripting.jscript) or you can use ASP to post to another
form where the question can be asked.

By the looks of it, you are looking at a Javascript solution..

Chris
 
S

Steven Burn

<%
Option Explicit
Dim username,rsDelete,startletter
startletter = Request.QueryString("startletter")
if Session("fewmetadminlogin") = "True" then
if request.querystring("confirm_delete")="Yes" then
username = Request.QueryString("username")
%>
<!--#include file="../includes/conn.asp"-->
<%
set rsDelete = conn.Execute("DELETE * FROM users WHERE username = '"
& username & "'")
conn.close
set conn = nothing
else
%>
<a href="<%=request.servervariables("url")%>&confirm_delete=Yes">Aww, go
on then</a>
<%
end if
end if
Response.Redirect("default.asp?startletter=" & startletter)
%>


--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
B

Bullschmidt

Here's something similar I've done using onclick and JavaScript:

<% ' *** btnDel %>
<input type="submit" name="btnDel" value="Delete" onclick="return
confirm('Are you sure you want to delete this record?');">

Best regards,
J. Paul Schmidt, Freelance ASP Web Designer
http://www.Bullschmidt.com
ASP Designer Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top