A form html is used to collect user data and send the data to the server . You need to declare in the tag “form” an attribute called “action” and then declare to path to your php file. To pass the data from the input text to the php file you should declare the attribute “name” in the input field and give to the input a custom name. You can use the attribute “placeholder” or the tag “label” to describe the input field to your client .
Example:
<form action="/sendData.php" method ="POST">
<label for="firstName">First name:</label>
<input type="text" id="firstName" name="firstName placeholder = "firstName">
<label for="LastName">Last name:</label>
<input type="text" id="lastName" name="lastName" placeholder = "lastName">
<label for="Email">Email:</label>
<input type="email" id="emailInput" name="email" placeholder = "email">
<button type="submit" value="Submit"></button>
</form>
input type=”text” – Declaring the input field as a text.
<input type="text">
input type=”radio” – Declaring the input field as a radio, If you want to choose between number of options.
<form action="/sendData.php" method ="POST">
option 1<input type="radio" name="options" value = "Option 1">
option 2<input type="radio" name="options" value = "Option 2">
option 3<input type="radio" name="options" value = "Option 3">
</form>
input type=”checkbox” -Declaring the input field as a checkbox, If you want to choose multiple options.
<form action="/sendData.php" method ="POST">
checkbox 1<input type="checkbox" name="checkboxs" value = "checkbox 1">
checkbox 2<input type="checkbox" name="checkboxs" value = "checkbox 2">
checkbox 3<input type="checkbox" name="checkboxs" value = "checkbox 2">
</form>
input type=”email” -Declaring the input field as a email, You can put only email in this field , must put @ symbol in the email.
<form action="/sendData.php" method ="POST">
Your Email <input type="email" name="email" placeholder="Put your email here">
</form>
input type=”submit” – Allow you to send the form.
<form action="/sendData.php" method ="POST">
<input type="text" name="exampleText" placeHolder ="exampleText">
<button type ="submit">Send the form</button>
</form>
input type=”reset” – Clear the form.
<form action="/sendData.php" method ="POST">
<input type="text" name="exampleText" placeHolder ="exampleText">
<button type ="reset">Clear</button>
</form>
Tags:
Tag – “textarea” – Declaring the input field as a textarea, Allow you to insert more text then the regular “text” input.
<form action="/sendData.php" method ="POST">
<textarea placeholder ="Insert some text"></textarea>
</form>
Tag – “select” – Declaring the input field as a select, Allow you to choose between options in drop-down list.
<form action = "/sendData.php">
<select>
<option>apple</option>
<option>pizza</option>
</select>
</form>
More info about form html in w3Schools – https://www.w3schools.com/html/html_forms.asp.
More html tutorials – http://omzas.com/html/