Yes, I think I'll do that in Javascript. It's even faster than any
server-side language...
What about users without javascript? What about SQL injection? You HAVE to
check serverside to make sure someone isn't doing something bad.
So how would you solve this problem?
Thank you for suggestions!
You test for the value of each submit button.
<input type="submit" value="Add" name="add">
<input type="submit" value="Delete" name="delete">
Depending on which one, you confirm to the user before committing the
change. You could do the confirm with javascript or server side. Here's a
simple example in ASP:
<% dim add, delete, confirm, isadd, isdelete, isconfirmed, confirmadd,
confirmdelete
if not isconfirmed then
if request.form("add") = "add" then
isadd = true
isconfirmed = true
elseif request.form("delete") = "delete" then
isdelete = true
isconfirmed = true
end if
else
if request.form("confirm") = "Confirm Addition" then
'do your insert
elseif request.form("confirm") = "Confirm Deletion" then
'do you delete
else
'throw an error
end if
end if
%>
<% if not isconfirmed then %>
<form method="post" action="<%=request.servervariables("script_name")%>">
<p>
.......
<input type="submit" value="add" name="add">
<input type="submit" value="delete" name="delete">
</form>
<% else %>
<form method="post" action="<%=request.servervariables("script_name")%>"
<% if isadd then %>
<p>You are about to add the following...
<input type="submit" value="Confirm Addition" name="confirm">
</p>
<% end if%>
<% if isdelete then %>
<p>You are about to delete the following...
<input type="submit" value="Confirm Deletion" name="confirm">
</p>
<% end if %>
</form>
<%end if%>