anshu
0
Q:

html form attributes

<form action="/action.php">
  <label for="fname">First name:</label><br>
  <input type="text" id="fname" value="Mike"><br><br>
  <label for="lname">Last name:</label><br>
  <input type="text" id="lname" value="Walker"><br><br>
  <input type="submit" value="Submit">
</form>
20

 <form>

    <label for="fname">First name:</label><br>
  <input 
  type="text" id="fname" name="fname"><br>
  <label for="lname">Last 
  name:</label><br>
  <input type="text" id="lname" name="lname">
</form>
 
4
<form action="/action_page.php">
  <label for="fname">First name:</label><br>
  <input type="text" id="fname" name="fname" value="John"><br>
  <label for="lname">Last name:</label><br>
  <input type="text" id="lname" name="lname" value="Doe"><br><br>
  <input type="submit" value="Submit">
</form>
The <form> tag is used to create an HTML form for user input.

The <form> element can contain one or more of the following form elements:

<input>
<textarea>
<button>
<select>
<option>
<optgroup>
<fieldset>
<label>
<output>

form tag main attributes 
 1. action : contains url of the page where form data get redirected on submit button click
 2. method : contains method in which way it tranfer the data i.e get,post
  
    a. get : this method shows the form data along the url in browser address bar
    b. post : this method does not show any form data in url it transfer data in hidden form
---------------------------------------------------------------------------------------------
  
Example below : 
//An HTML form with two input fields and one submit button:
    <form action="/action_page.php" method="get">
      <label for="fname">First name:</label>
      <input type="text" id="fname" name="fname"><br><br>

      <label for="lname">Last name:</label>  
      <input type="text" id="lname" name="lname"><br><br>

      <input type="submit" value="Submit">
    </form>
1
The <form> tag is used to create an HTML form for user input.

The <form> element can contain one or more of the following form elements:

<input>
<textarea>
<button>
<select>
<option>
<optgroup>
<fieldset>
<label>
<output>

form tag main attributes 
 1. action : contains url of the page where form data get redirected on submit button click
 2. method : contains method in which way it tranfer the data i.e get,post
  
    a. get : this method shows the form data along the url in browser address bar
    b. post : this method does not show any form data in url it transfer data in hidden form
---------------------------------------------------------------------------------------------
  
Example below : 
//An HTML form with two input fields and one submit button:
    <form action="/action_page.php" method="get">
      <label for="fname">First name:</label>
      <input type="text" id="fname" name="fname"><br><br>

      <label for="lname">Last name:</label>  
      <input type="text" id="lname" name="lname"><br><br>

      <input type="submit" value="Submit">
    </form>
 
2

New to Communities?

Join the community