hi good day to all.

im new in ASP and one of my questions now is:

is it possible to have 2 command buttons in one asp page?
if possible how can i separate their actions in one form?
wherein the first button will give the total no. of students
and the second one will give me the total no. of teachers

please...i badly need you help. thanks a lot in advance.

I hope the below code helps.

<%
If Request("num_student") = "1"  Then
  Response.Write "Number of student button was clicked."
  ' add your other script here
else 
  Response.Write "Number of teacher button was clicked."
  ' add your other script here
End If
%>
<form name="form1" action="" method="post">
<input type="hidden" name="num_student" value="1">
<input type="submit" value="Number of Student">
</form>
<form name="form2" action="" method="post">
<input type="hidden" name="num_teacher" value="1">
<input type="submit" value="Number of teacher">
</form>

I hope the below code helps.

<%
If Request("num_student") = "1"  Then
  Response.Write "Number of student button was clicked."
  ' add your other script here
else 
  Response.Write "Number of teacher button was clicked."
  ' add your other script here
End If
%>
<form name="form1" action="" method="post">
<input type="hidden" name="num_student" value="1">
<input type="submit" value="Number of Student">
</form>
<form name="form2" action="" method="post">
<input type="hidden" name="num_teacher" value="1">
<input type="submit" value="Number of teacher">
</form>

*******************************************************

hi zippee!

its great, although the sample code is simple but good enough to understand and manipulate...thanks a lot for that one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.