View / Download this file.
---------------
%_POST VARIABLE
---------------
-----------
DESCRIPTION
-----------
The %_POST variable stores HTML form data submitted via the POST method.
%_POST is a hash/associative array which stores POST data in name=value
pairs in the following format:
%_POST = (
field1 => 'value1',
field2 => 'value2',
field3 => 'value3'
);
The %_POST keys (input field names) can be accessed as a list (array) with
Perl's "keys" command like so:
@field_names = keys %_POST;
The field values can be accessed by referencing the specific name of the
requested field:
$field_value = $_POST{'field1'};
Notice that when referencing a specific field value, the '%' is changed to a
'$' when referencing the hash, as you are referencing a specific value and
not the entire hash.
--------------
USAGE EXAMPLES
--------------
------------------------------------------------------------------
Example 1: Showing the Value of a POST Field using the DISPLAY Tag
------------------------------------------------------------------
The value of the Name field is <?= $_POST{'Name'} ?>.
--------------------------------------------------------------------------
Example 2: Showing All the Fields using the DO and DISPLAY Tags and a Loop
--------------------------------------------------------------------------
<? foreach $field (keys %_POST) { ?>
The value of the <?= $field ?> field is <?= $_POST{$field} ?>.<br>
<? } ?>
--------
SEE ALSO
--------
TAGS
DO, DISPLAY
VARIABLES
%_GET
|