I don't quite understand what you want, but I think you're looking for the following:
On a single line:
$raw_data = file_get_contents("php://input");
in an array
$array_data = $_POST // this is already an array?
Question
I want to capture all posted data in one single line like name=asd&age=12&city=something
and as an array while the data were posted by using form. (I don't wanna capture values like "$name=$_POST['name']")
(Ques-1: as a single line.
Ques-2: as an array.)
How can I do that ?
-Thanks.
Solution
I don't quite understand what you want, but I think you're looking for the following:
On a single line:
$raw_data = file_get_contents("php://input");
in an array
$array_data = $_POST // this is already an array?
OTHER TIPS
$postAsLine = file_get_contents("php://input");
$postAsArray = $_POST;
echo $_SERVER['QUERY_STRING']
for current GET query
http_build_query
for any array
in your case http_build_query($_POST)
You can use http_build_query($yourKeyValArray)
which creates a query string from an array.
it sound like it:
$getAll = serialize($_POST);
$getAsArray = $_POST;
GOOD LUCK