#24178 [Bgs]: Post an array
| From: | fernando at reweb dot com dot br | Date: | Fri, 13 Jun 2003 20:31:59 +0000 |
| Subject: | #24178 [Bgs]: Post an array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-41880@lists.php.net to get a copy of this message | ||
ID: 24178
User updated by: fernando at reweb dot com dot br
Reported By: fernando at reweb dot com dot br
Status: Bogus
Bug Type: Arrays related
Operating System: Free BSD 4.8
PHP Version: 4.3.2
New Comment:
My form was in that way:
<form action=\"send.php\" method=\"post\">
and didn´t work too.
Previous Comments:
------------------------------------------------------------------------
[2003-06-13 15:28:51] sniper@php.net
Default "send" method for forms is GET, not POST.
Change:
<form action="send.php">
to:
<form action="send.php" method="POST">
and it will work fine.
------------------------------------------------------------------------
[2003-06-13 14:49:44] fernando at reweb dot com dot br
Description:
------------
When I post an array and try do recover it I can´t do it. The result
values doesn´t fetch the posted values.
Reproduce code:
---------------
##form.php##
<form action=\"send.php\">
<input type=\"checkbox\" name=\"opt[]\" value=\"aaa\">
<input type=\"checkbox\" name=\"opt[]\" value=\"bbb\">
<input type=\"checkbox\" name=\"opt[]\" value=\"ccc\">
<input type=\"checkbox\" name=\"opt[]\" value=\"ddd\">
<input type=\"checkbox\" name=\"opt[]\" value=\"eee\">
<input type=\"submit\" value=\"Send\">
##send.php##
$vars = $_POST;
$opcoes = $vars['opt'];
echo "$opcoes[0]###$opcoes[1]###$opcoes[2]###$opcoes[3]###$opcoes[4]";
## The result should be "aaa###bbb###ccc###ddd###eee", but it prints
"A###r###r###a###y" (the word "Array")
Expected result:
----------------
aaa###bbb###ccc###ddd###eee
Actual result:
--------------
A###r###r###a###y
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24178&edit=1