You are correct, and I must apologize.
In addition to the modifications below I added a pair of brackets
to the select clause:
select name=item[]
After removing those the $_POST array looks much better
and I was able print the selected item using
echo Selected item is: .$_POST['item'];
Results
The first execution of the file below produces the expected output:
Request Method: GET
Clicking on the Submit button outputs:
Request Method: POST
$_POST array contains:
Array
Why don't I see one of the values from the select item?
Gregg Nelson wrote:
The first execution of the file below produces the expected output:
Request Method: GET
Clicking on the Submit button outputs:
Request Method: POST
$_POST array contains:
Array
Why don't I see one of the values from the select item?
Thank you for your very quick answer. As you may have already guessed, I'm
new to PHP, and struggling with the the most basic operations.
I modifed the 'echo' as suggested and also added a 'printr statement.
The modified portion of the script is below
if ($_SERVER['REQUEST_METHOD'] ==
Gregg Nelson wrote:
snip
Clicking on the submit button now produces:
--
Request Method: POST
Using foreach loop, $_POST array contains:
Array
Using printr, $_POST array contains:
Array
(
[item] = Array
(
5 matches
Mail list logo