Hi
I am experienceing a strange problem which I cannot figure out. The following code works as I would expect with the CGI version on IIS, however on APACHE it returns "0 = 56789", instead of "0 = 123456789".
If you shorten the length of the field to 4 characters e.g. "1234", it returns nothing for the value. If you shorten the length of the field to 3 characters e.g. "123", it returns the value as it should, e.g. "123".
Can anyone tell me whats going on here, and/or tell me how to get around it?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test Form Array</title>
</head>
<body topmargin="50" leftmargin="200" marginheight="50" marginwidth="200">
<?
if (count($HTTP_POST_VARS) == 0)
{
?>
<form method="post" action="testForm.php">
<b>Number of items: </b>
<input type="text" name="itemCount" maxlength="1"><br>
<input type="submit" name="action" value="Go1">
</form>
<?
}
else if ($HTTP_POST_VARS["action"] == 'Go1')
{
?>
<form method="post" action="testForm.php">
<?
for ($i=0; $i < $HTTP_POST_VARS["itemCount"]; $i++)
{
echo '<b>Item '. ($i + 1) .': </b><input type="text" name="item['. $i .']" value="123456789"><br>';
}
?>
<input type="submit" name="action" value="Go2">
</form>
<?
}
else if ($HTTP_POST_VARS["action"] == 'Go2')
{
foreach ($HTTP_POST_VARS["item"] as $var => $val)
{
echo $var .' = '. $val .'<br>';
}
}
?>
</body>
</html>