note 55533 added to langref

From: Date: Sat, 06 Aug 2005 03:29:28 +0000
Subject: note 55533 added to langref
Groups: php.notes 
Request: Send a blank email to php-notes+get-93152@lists.php.net to get a copy of this message
Im creating a program that compute the total amount by multiplying the qty to the price..that sounds easy but the problem is...i "echo" the the names of the fileds so that i can add as many rows as i want, but i limit it to ten...the program looks like this.... <?php echo "<table width=10%><tr><td align='center'>QTY</td><td align='center'>PRICE</td><td align = 'center'>AMOUNT</td></tr>"; $trow = $raw+$raaw; if ($trow < 10){ for ($i=0; $i<=$raw+$raaw; $i++) { $a = $i + 1; echo "<tr> <td width='1%' height='2' align='center' bgcolor='#FFFFFF' align='left'><input type='text' name='qty[$i]' style='text-align: Center' size='5' maxlength=4 onfocus='FocusIn(this); startCalc()' onblur='FocusOut(this); stopCalc(); javascript:document.form1.um.focus()' onkeyup='FilterNonNumeric(this)' value='"; echo $qty[$i]; echo "' ></td>"; echo "<td width='1%' height='2' align='center' bgcolor='#FFFFFF' align='left'><input type='text' name='unitprice[$i]' style='text-align: Center' size='10' maxlength=9 onfocus='FocusIn(this); startCalc()' onblur='FocusOut(this); stopCalc(); javascript:document.form1.sys_id.focus()' onkeyup='FilterNonNumeric(this)' value='"; echo $unitprice[$i]; echo "'></td><td width='24%' height='2' align='left' bgcolor='#FFFFFF' align='left'><input type='text' name='amount[$i]' style='text-align: Center' size='10' maxlength=9 onfocus='FocusIn(this);' onblur='FocusOut(this);' value='"; echo $amount[$i]; echo "'></td><tr>"; } }else{ echo "<b>Unable to comply...Too many rows inserted!</b>\n"; echo "<b>Limit is only 10...Sorry!</b>\n"; echo "<b>Click <a href='f.php'>here</a> to new form.</b>"; } echo "</table><br>"; // this is to see wat's going in the values of the fields $tqty = array($i => $qty); print_r ($tqty); echo "<br>"; $unit = array ($i => $unitprice); print_r ($unit); echo "<br>"; $amt = array ($i => $amount); print_r ($amt); echo "<br>"; echo "<br>"; ?> so any one pls.. give me an idea how can i give the amount in each row by multiplying the qty and price on that specific row...pls send me your contribution....at xxxRHEIGNxxx@yahoo.com...thx for help.... ---- Manual Page -- http://www.php.net/manual/en/langref.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55533 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55533&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55533&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55533&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55533&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55533&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55533&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55533&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93152) next »