Re: help with adding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try this:


$num=0; for ($i = 1; $i <= $sendnum; $i++)

 {

             $qty = $_POST['qty'.$i];

             $num=$num+ $qty ;

 }

  echo $num;




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)?



Any help is appreciated.





-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux