Forms and URLs

Jun 15, 2009 Author: Developer

Most often, your script will interact with their clients using one of two HTTP methods: GET and POST. Froma technical perspective, the main difference between these two methods is in the fact that the latter allows the client to send along a data payload, while the former only allows you to send data as part of the query string. This, of course, doesn’t mean that you can’t submit a form using GET—only that you will be somewhat limited in the size and type of data that you can send. For example, you can only upload files using POST, and almost all browsers implement limitations on the length of the query string that confine the amount of data you can send out with a GET operation. Important: Contrary to popular belief, POST is not an inherently more secure to submit forms than GET.We explain this concept in greater detail in the Security chapter. From an HTML perspective, the difference between GET and POST is limited to the action attribute of the <form> element:

<!--Form submitted with GET--
<form action="index.php" method="GET"
List: <input type="text" name="list" />
<br />Order by:<select name="orderby"><option value="name">Name
</option><option value="city">City</option>
<option value="zip">ZIP Code</option>
</select><br />Sort order:<select name="direction">
<option value="asc">Ascending</option>
<option value="desc">Descending</option>
<!--Form submitted with POST-->
<form action="index.php" method="POST">
<input type="hidden" name="login" value="1" />
<input type="text" name="user" />
<input type="password" name="pass’ />

tags: Forms URLs

views 3324
  1. Add New Comment