Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 31st, 2005, 09:38 AM
Authorized User
 
Join Date: Jun 2003
Location: Jewett City, CT, USA.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default 2 buttons going to same ASP page

    I have an Instructor's form in which the instructor may either add a student to the database by clicking on an "Add Student" button, or select a particular report on the student to view from a drop-down and click a "View Report" button.
    I would like to have both buttons go to the same ASP page and have the ASP page determine whether to display the "New Student" form or to access the database to create the appropriate report. The buttons each have different names, so I what I'd like to do is figure out which button was pressed. Can I do this? And if so, how do I find out which button was pressed?


Chris

  #2 (permalink)  
Old June 1st, 2005, 03:00 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

You can have both the buttons with type="submit" on single form.

Then on top of your page check which value comes on form submit.

Code:
<%
IF request.form("ADD") = "itsvalue" Then
    'code to add student
END

IF request.form("View") = "itsvalue" Then
    'code to View report
END
%>
"itsvalue" refers to the value that you defined in the value attribute of the <input> tag.

This is a sample of code that should help you.

_________________________
- Vijay G
Strive for Perfection


Similar Threads
Thread Thread Starter Forum Replies Last Post
having two submit buttons in asp page and passing KGANESH2006 Classic ASP Basics 1 April 24th, 2006 09:58 PM
Page 1-2-3-4 etc.... Next and Previous buttons crmpicco Classic ASP Basics 1 March 18th, 2005 12:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.