| Linda H 2005-10-18, 6:57 pm |
|
>
>2) the name/value pair will only be POSTed if it's checked, so that
>would only work if the first two were checked.
>
>Some people like to pair all their checkboxes with a hidden of the same
>name, the hiddens value will be sent if the checkbox isn't checked.
The following method worked well for me using the ternary conditional
operator (?:):
$step = (isset($_POST['step'])) ? $_POST['step'] : NULL;
isset checks to see if a field named 'step' was received thru a POST
operation. The statement creates a variable named $step. If the field
'step' was passed, it sets $step to it's value. If the field 'step' was not
passed, it sets $step to NULL (you could set it to anything you wanted).
Be sure you keep it straight whether the field you are looking for was
passed by a POST or a GET. If the field is appended on the URL, use
$_GET['fieldname']. It is possible to receive formfields through a POST
operation and fields on the URL (use GET) at the same time.
LInda Hobbet
|