[arrays] read arrays from a form
| From: | �lex Camps | Date: | Thu, 13 Jun 2002 11:16:54 +0000 |
| Subject: | [arrays] read arrays from a form | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-85191@lists.php.net to get a copy of this message | ||
I have a example.html
-------------------------------
<script>
function add()
{
var res=0;
for(x=0;x<3;x++)res=res+parseFloat(example.text[x].value);
example.result.value=res;
}
</script>
<html>
<form name="example" action="show.php">
<input type="text" name="text" value="1"><br>
<input type="text" name="text" value="2"><br>
<input type="text" name="text" value="3"><br>
<input type="text" name="result" value="0"><br>
<input type="button" value="add" OnClick="add()">
<input type="submit" value="show">
</form>
</html>
-------------------------------
and show.php
-------------------------------
<html>
<?
echo $text[0]."+".$text[1]."+".$text[2]."=";
echo $result;
?>
</html>
PHP return the error:
Notice: Uninitialized string offset: 1 in show.php on line 4
How could I know the values of the text? without modify example.html