Learn about Basic ASP Forms and Inputs by User (9.2 ASP):

9.2 asp

Just for revision:

Request.From:

It is a command which is used to get values in a form by using “post” method. The information which is sent by a form using get method is not available to everyone. This information also has no limits on its amount. The difference is that if the user would have typed “you” and “angel” in the HTML form then the URL sent to the asp server would be:

http://www.website-school.com/formex.asp

But if the file has asp scripts:

<body>

Hey

<%

Respone.write(request.form(“myname”))

Respone.write( “ “ &request.form(“mynames”))

%>

</body>

The internet browser will display:

Hey you angel

 

Following example shows how to use post method and Request.Form to interact with user:

Example of a Form by using Request.Form and “post” as a method:

<html>

<body>

<form action=”form_requeryzx.asp” method = “post”>

Name: <input type = “text” name = “myname” sixe = “12”/>

<input type = “submit” value = “submit”/>

</form>

<%

Dim myname

Frame=Request.Form(“myname”)

If myname<>””Then

Response.Write(“Hello” & myname & “/<br/>”)

Response.Write(“Whats up dude”)

End if

%>

</body>

</html>

Following example shows how to use radio buttons and Request.Form to interact with user:

Example of a Form by using Request.Form and radio buttons:

<script type=”text/javascript”><!–
google_ad_client = “ca-pub-7789281879799866”;
/* webpost */
google_ad_slot = “1930114734”;
google_ad_width = 300;
google_ad_height = 250;
//–>
</script>
<script type=”text/javascript
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>

<html>

<%

Dim bikes

bikes=Request.Form (“bikes”)

%>

<body>

<form action=”form_radiobt.asp” method = “post”>

<p> Please select high quality bike:</p>

<input type = “radio” name = “car” />

<% if bikes = “Honda” then Response.Write(“checked”)%>

Value = “Honda”>Honda</input>

<br/>

<input type = “radio” name = “car” />

<% if bikes = “Yamaha” then Response.Write(“checked”)%>

Value = “Yamaha”>Yamaha</input>

<br/>

<input type = “submit” value = “submit”/>


</form>

<%

If bikes<>””Then

Response.Write(<p> Your high quality bike is: & bikes & “/<p>”)

End if

%>

</body>

</html>

The Form Validation:

It is compulsory for user input to be validated on the internet browser whenever it is possible. The Browser validation is easier, faster and decreases the load on the server.

If the user input is entered into the database then you should consider the matter of validation. The best way to validate a form is to post the form to itself rather than going to different page. In this way user will get the error message on the same page as the form. Thus finding the error will be much easier.

For more visit next posts in this category.To go back to Contents of this tutorial: ASP Active Server Side Scripting Contents

email

2 Responses to Learn about Basic ASP Forms and Inputs by User (9.2 ASP):

  1. You actually make it seem really easy with your presentation however I find this matter to be actually something which I think I’d by no means understand. It kind of feels too complex and very extensive for me. I am having a look forward on your subsequent publish, I will try to get the hold of it!

    • admin says:

      have u learned HTML.. i fyou understand HTML, Java and XML then this should not be difficult for you…

Leave a Reply