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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Forms in one asp page

Status
Not open for further replies.

brentnewbury

Programmer
May 1, 2001
30
GB
Hi all,

I have a login script, that you can login, change your details, change your password, retrieve your password, and so on.

Say a person wanted to login in. They go to login.asp, then when they click the 'Login in' button it takes them to login_action.asp. How can I make it submit to the same asp form. I know how to do this in php but not asp. So for all the things that the user can do, there are alot of scripts, just to do a few simple things.

This is how it is done in php:

If (!Submit)
{
?>
HTML STUFF HERE AND FORM
<?
}
else
{
WHATEVER YOU WANT TO DO WITH THE FORM INPUT. I.E. INSERT INTO DATABASE
}
?>


Thnx for your time,

Brent Newbury
 
You need to check if anything has been submitted to the page using Request.Form for the get method or Request.Querystring for the PUT method. I will show you how with the get method.

<%
If Request.Form(&quot;RequiredFormElement&quot;) = &quot;&quot; Then
%>
DO HTML AND FORM STUFF
<%
Else
%>
DO WHATEVER YOU WANT TO DO WITH THE FORM DATA
<%
End If
%>

G -GTM Solutions, Home of USITE-
-=
 
Another way you can do this is by using a CASE statement. Send a variable to the page either hidden or set as the name of a button. We name our buttons Action and set the value as the text of the button. So:

<%
SELECT CASE Request(&quot;Action&quot;)
Case &quot;&quot;%>
<form NAME=&quot;Login&quot; METHOD=&quot;POST&quot; ACTION=&quot;Login_action.asp&quot;>
HTML stuff here
<input NAME=&quot;Action&quot; TYPE=&quot;SUBMIT&quot; VALUE=&quot;Update Password&quot;>
</form>
<%Case &quot;Update Password&quot;%>
Do database stuff here
<%End Select%>

Regards,
Joli
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top