Hi.
I have the following PHP program executed from an HTML form where I pass
the associative array key name as a variable:
<?
function show($name)
{
$cnt = count($HTTP_POST_VARS[$name]);
echo "Count for $name is $cnt";
echo "<br />";
}
show("countries");
show("cities");
?>
The result is always 0. The form fields do have name=countries[] and
name=cities[] to indicate an array.
When I hardcode the count line in the function as follows just to test
to make sure the transfer from the browser works, it displays a correct
non-zero result:
$cnt = count($HTTP_POST_VARS["cities"]);
I even tried these statements in the function but all give a 0 result:
$cnt = count($HTTP_POST_VARS["".$name.""]);
How do I get the count line to work with a variable in the function?
Thanks,
Eurico
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php