Penn State

Web Conference 2005

Writing PHP for ITS/ASET Web services

The POST Method

<- Back - Basic Web Form|Up |Email Submission Form - Next ->

Using POST data

Here is the same form as used in the last exercise but using the POST method:

What is your favorite color: <-- try it out!

Using the POST method in a Web form

You may convert a form to use the POST method by simply setting the method attribute of the <form> tag as follows:

Using POST parameters in PHP

About the POST method

The second most popular HTTP protocol request method is the POST method. It differs from the GET method in the following ways:

GETPOST
Query String is placedIn the URL (HTTP request header)In the HTTP request body
Parameters may be sent via a plain HTML Web formYesYes
Parameters may be sent via JavaScript or other client side scriptingYesYes
Parameters may be sent over a redirectYesNo (some browsers may resend POST data after being redirected)
Parameters may be sent via a plain hyperlinkYesNo
Parameters may be bookmarkedYesNo
Parameters will be seen in the browser historyYesNo (some browsers may allow resending of POST data during the same session)
Parameters will be seen in the server logsYesNo
Parameters are safe for passwords and other sensitive dataNoYes (assuming other security precautions are taken)
Parameters are safe for large amounts of data (>1KB)NoYes
Parameter names and values are encoded making it safe for binary dataYesYes
Parameters may be read from the PHP arrays$_GET and $_REQUEST$_POST and $_REQUEST
<- Back - Basic Web Form|Up |Email Submission Form - Next ->

If you have any questions, feel free to ask me.

Content by: Jeff D'Angelo <jcd@psu.edu> © 2005

See the source for this page

Last update on: Mon Jun 29, 2009, 12:06:28 AM