Hashemian Blog
Web, Finance, Technology

HTML Forms, Part 3

    📂 Web         🗨 No Comments

Click here to read Part 2

The following is a simple example of an HTML form:

<form method="post" action="page.php">
Name: <input type="text" name="Name"><br>
City: <input type="text" name="City"><br>
<input type="submit" value="Submit">

This basic segment is placed inside an HTML page and when users browse to that page, they generally see something like this:


The user is expected to fill in values for the Name and City and submit the form. Upon submission, the data is encoded, posted back to the server and routed to 'page.php' for handling. The general transmission is something like the following:

POST /page.php HTTP/1.1
Host: www.website.com
User-Agent: Mozilla/5.0
Content-Length: 27
Content-Type: application/x-www-form-urlencoded


The first paragraph is the header describing the size and MIME type of the data among other information. The second paragraph contains the submitted data in an encrypted format with the fields delimited with '&'. The handling page, 'page.php', would generally contain a script to digest the data and take some kind of an action, such as validating the data, saving them to a database, or look up and display related information based on the submitted data.

This, of course, is a simple form, but all HTML forms behave the same way at their cores. Debugging forms is a relatively straight-forward task these days. The simplest step is to have the receiving page just print out the submitted values back to make sure that the page is correctly receiving the submitted data. Sometimes, however, it might be helpful to inspect the POST data in raw format. In those cases, scripts can be written to receive the data and display them without any processing. There are also utilities available online that can be used to achieve the same task with ease.

This site also has one such tool available that users can utilize to view their form POST data in raw format. To use this tool, the 'action' parameter of the form is set to the page's URL.Tthe form is then populated and submitted and the page. Upon submission, the POST data is displayed to the user. Visit Form Post Tester/Viewer for more information on this tool.

Your Comment


* Comments are subject to screening and manual approval.

Read Financial Markets  |   Home  |   Web Tools  |   Blog  |   News  |   Articles  |   FAQ  |   About  |   Privacy  |   Contact
Give a few Sats: 1GfrF49zFWfn7qHtgFxgLMihgdnVzhE361
© 2001-2024 Robert Hashemian   Powered by Hashemian.com