More than one form in HTML page

In HTML page, we can use more than one form. Sometimes it is useful to add more forms in webpage.

Suppose we have a home page. In home page, we have two options, either user can register as new member or login to application.

This condition is more useful for using more than one form in html page.

This keeps form property separate from other form which is defined. We can use same text field name in both forms and on submit we will get only one related form text field value.

In javascript, we can access form property with form name or array of form e.g. form[0], form[1].

See the example

<html>
<head>
<title>Use more than one form in html page</title>
</head>

<body>
<form name="frm1" action="actionPage1.jsp">

<input type="text" name="txtName">
<input type="submit" name="goSubmit" value="Submit">

</form>

<form name="frm2" action="actionPage2.jsp">

<input type="text" name="txtName">
<input type="submit" name="goSubmit" value="Submit">

</form>

<form name="frm3" action="actionPage3.jsp">

<input type="text" name="txtName">
<input type="submit" name="goSubmit" value="Submit">

</form>
</body>
</html>
Bookmark  

 

Leave a Reply

Security Code:

 

  Random Post