Thursday, June 7, 2012

All About HTML Forms

The two things you must have when it comes to using the form tag is one the action attribute and second the method attribute. I also often use the enctype attribute when doing file uploads.

<form action="get-data.html" method="post" enctype="multipart/form-data"> </form>

The method attribute takes 'get' or 'post'. Get will send the data in plain text in the URL (not secure for more sensitive information) while post sends data as a http post transaction (more secure).

The enctype attribute specifies how the form data is encoded when submitting it to the server. I generally use enctype="multipart/form-data" when uploading a file. No characters are encoded, but it is necessary for file transactions.

No comments:

Post a Comment