Can I use php to read values from one input and store it in array?
I want to read multi integers from the user and calculate the total of them if the user entered ZERO!
For example, I add one input text and one submit:
<form method="GET">
enter numbers : <input type = "text" name="txt">
<input type = "submit" value = "Calculate">
</form>
then use php to read them !!
<?php
$n = @$_GET[txt];
$i=0;
while ($n!=0)
{
$ary[$i]=$n;
$i++;
}
if ($n==0)
echo @count($ary);
?>
it doesn't work .. what should I do here? There is the same problem in java, but there I can use scanner. Can any one help to solve it with php?