Posted by gustav on 10/04/67 11:09
Hi there!
I guess
$sum =+ intval($_POST['qty'.$i]);
should be
$sum += intval($_POST['qty'.$i]);
/G
@varupiraten.se
> Jay Fitzgerald wrote:
>> I have messed with this for a couple of days and cant get it right.
>> Maybe I
>> need sleep :-)
>>
>>
>>
>> The code below is echoing the qty correctly (10, 5, 25)
>>
>>
>>
>> for ($i = 1; $i <= $sendnum; $i++)
>>
>> {
>>
>> $qty = $_POST['qty'.$i];
>>
>> echo $qty . '<br />';
>>
>> }
>>
>>
>>
>> The question is, how would I take add each of these numbers (10+5+25)?
>
> $sum = 0 // init the var
> for ($i = 1; $i <= $sendnum; $i++) {
> $sum =+ intval($_POST['qty'.$i]);
> }
> echo "$sum<br />";
>
>>
>>
>>
>> Any help is appreciated.
>>
>>
>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
[Back to original message]
|