HTML - attributes - e....

revision:


"enctype" attribute : specifies how the form-data should be encoded

This attribute is used on the <form> element.
It specifies how the form-data should be encoded when submitting it to the server.
It can be used only if method="post".

syntax

<form enctype="value"></form>

enctype attribute can have the following values:

application/x-www-form-urlencoded: default; all characters are encoded before sent (spaces are converted to "+" symbols, and special characters are converted to ASCII HEX values).

multipart/form-data: this value is necessary if the user will upload a file through the form.

text/plain: sends data without any encoding at all. Not recommended.

some examples

example




codes:

                    <form style="margin-left:5vw;" action="/action_page_binary.asp"
                    method="post" enctype="multipart/form-data">
                        <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>
                

example
First name:
Last name:
Address:

codes:

                    <form style="margin-left:5vw;" action="#"  method="post" enctype="multipart/form-data">
                        First name:
                        <input type="text" name="fname">
                        <br> Last name:
                        <input type="text" name="lname">
                        <br> Address:
                        <input type="text" name="Address">
                        <br>
                        <input type="submit" value="Submit">
                    </form>