Any idea how I pull those values?
foreach ($_GET as $field => $label) {
$datarray[]=$_GET[$field];
echo "$_GET[$field]";
echo "<br>";
This is the output I am getting. I see the data is there in datarray but when I echo $_GET[$field] I only get "Array"
But print_r($datarray) prints all the data. Any idea how I pull those values?
OUTPUT:
Array (
开发者_StackOverflow中文版 [0] => Array (
[0] => Grade1
[1] => ln
[2] => North America
[3] => yuiyyu
[4] => iuy
[5] => uiyui
[6] => yui
[7] => uiy
[8] => 0:0:5
)
)
foreach ($_GET as $key => $value)
{
if(is_array($value))
{
foreach($value as $childKey => $childValue)
{
echo $childKey." ".$childValue; // or assign them to an array
}
}
else
echo $key." ".$value; // or assign them to an array
}
Seems like $_GET[$field]
is basically $_GET[0]
, which is an array:
You'll have to loop through $_GET[$field]
with a forloop to get the content to echo out. By the way you can't echo array you'll have to use print_r
something like this:
foreach ($_GET as $field => $label) {
$datarray[]=$_GET[$field];
for($i=0; $i<$_GET[$field]; $i++){
echo $_GET[$field][$i];
}
echo "<br>";
}
EDIT: When I completed your test, here was the final URL:
http://hofstrateach.org/Roberto/process.php?keys=Grade1&keys=Nathan&keys=North%20America&keys=5&keys=3&keys=no&keys=foo&keys=blat&keys=0%3A0%3A24>
This is probably a malformed URL. When you pass duplicate keys in a query, PHP makes them an array. The above URL should probably be something like:
http://hofstrateach.org/Roberto/process.php?grade=Grade1&schoolname=Nathan®ion=North%20America&answer[]=5&answer[]=3&answer[]=no&answer[]=foo&answer[]=blat&time=0%3A0%3A24
This will create individual entries for most of the fields, and make $_GET['answer'] be an array of the answers provided by the user.
Bottom line: fix your Flash file.
精彩评论