php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24178 Post an array
Submitted: 2003-06-13 14:49 UTC Modified: 2003-06-13 15:33 UTC
From: fernando at reweb dot com dot br Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.3.2 OS: Free BSD 4.8
Private report: No CVE-ID: None
 [2003-06-13 14:49 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-13 15:28 UTC] 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 15:31 UTC] fernando at reweb dot com dot br
My form was in that way:

<form action=\"send.php\" method=\"post\">

and didn?t work too.
 [2003-06-13 15:33 UTC] sniper@php.net
Why do you keep escaping the quotes??
It's not necessary. And in any case, you're just doing something wrong. Please ask further support questions elsewhere, there is no bug here.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 16:01:27 2024 UTC