Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Submit Buttons

Status
Not open for further replies.

debbie1212

Programmer
May 31, 2000
66
US
I'm having difficulty getting some code to work. I have a form that has 3 buttons on it to Add, Update and Delete records. I've been playing around with using a Select Case but can't get it to work. I'm trying to pass the value of the selected button through the query string to process the code that exists in the same asp file. I know this isn't that difficult to do but I'm still learning.

Any help anyone can give me would be greatly appreciated. Thanks!!!!
 
Debbie1212,

Copy this code into "Action.asp"

<html>
<body>
<%
action = request.querystring(&quot;action&quot;)
If action = &quot;&quot; then
response.write &quot;No Input&quot;
Else
response.write &quot;Action: &quot; & action
End if
%>

<form name=&quot;myform&quot; method=&quot;get&quot; action=&quot;action.asp&quot;>

<br><input type=&quot;submit&quot; name=&quot;action&quot; value=&quot;Add&quot;><br>
<br><input type=&quot;submit&quot; name=&quot;action&quot; value=&quot;Update&quot;><br>
<br><input type=&quot;submit&quot; name=&quot;action&quot; value=&quot;Delete&quot;>
</form>
</body>
</html>
 
Thank you so much for your quick response.

I tried your code and it still didn't work.

I don't want it to write a response on the page. If someone selects the Add button it's supposed to run Function AddItem to actually add the data to the database. Also, with using your code it is opening the initial page with &quot;No Input&quot; which was in the response.write. I don't want it to process the action until after the initial page loads and one of the buttons is selected.

So I tried changing the code to:

<%
action = Request.QueryString(&quot;action&quot;)
If action = &quot;Add&quot; then
Call AddItem
If action = &quot;Save&quot; then
Call RenameItem
If action = &quot;Delete&quot; then
Call DeleteItem
End If
%>

<FORM NAME=&quot;AdmCat&quot; ACTION=&quot;AdministerCategoryGroup.ASP?Command=EXECUTE METHOD=&quot;GET&quot;>

<INPUT type=&quot;submit&quot; value=&quot;Add&quot; name=&quot;action&quot;>
<INPUT type=&quot;submit&quot; value=&quot;Save&quot; name=&quot;action&quot;>
<INPUT type=&quot;submit&quot; value=&quot;Delete&quot; name=&quot;action&quot;>

And got this error message:

Microsoft VBScript compilation error '800a03ea'
Syntax error
/cfms/_ClassFileProperties.asp, line 16
class classFileProperties
^



 
Debbie1212,

You need to correct the syntax on the &quot;IF&quot; statement. Use the code below and try this. I was using the &quot;No Input&quot; and &quot;Action: &quot; as an example. Hope this works.

Fengshui1998


If action = &quot;Add&quot; then
Call AddItem
ElseIf action = &quot;Save&quot; then
Call RenameItem
ElseIf action = &quot;Delete&quot; then
Call DeleteItem
End If
 
Thanks!! I'm a lot closer now. It's still not doing the functions but by looking at the querystring I see that it's passing the information right. Now I'll just have to play with it some more.

Thanks again for all of your help and such a quick response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top