CGI

Parameters

GET

$param_value = $_GET['param_name'];
  • If the parameter was not sent, the value retrieved is NULL.

POST

$param_value = $_POST['param_name'];
  • If the parameter was not sent, the value retrieved is NULL.

Environment variables

$url       = $_SERVER['REQUEST_URI'];

$base_url = $_SERVER['SCRIPT_NAME'];
$url_query = $_SERVER['QUERY_STRING'];

HTML forms

Text field

  • If the field is empty, the value retrieved is an empty string.

Radio button

  • If no item was selected, the value retrieved is NULL.

Check box

  • If the field is unchecked, the value retrieved is NULL.
  • If the field is checked, the value retrieved is "on".

Single-selection list

  • If no item was selected, the value retrieved is NULL.

Multiple-selection list

  • In the HTML form, the name of the list must be followed by []
<select name="field_name[]" size="10" multiple>
  • The value is retrieved as an array of strings.
  • If no items were selected, the value retrieved is NULL.

Resources URL: 
notes/php/resources
Sources URL: 
notes/php/sources

See Also