1 Replies - 322 Views - Last Post: 28 November 2012 - 10:11 PM Rate Topic: -----

#1 izic  Icon User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 197
  • Joined: 15-January 09

Getting input from textbox in a table

Posted 28 November 2012 - 09:30 PM

Say I had a table:

<table border="1">
    <tr>
    <td>Product</td><td>Price</td><td>Quanity</td>
    </tr>
    <tr>
    <td>Unpopped Popcorn (1 lb.)</td><td>$3.00</td><td><input type="text" name="quanity1" style="width:50px;" placeholder="0"/></td>
    </tr>
    <tr>
    <td>Caramel Popcorn (1 lb. canister)</td><td>$3.50</td><td><input type="text" name="quanity2" style="width:50px;" placeholder="0"/></td>
    </tr>
    <tr>
    <td>Caramel Nut Popcorn (2 lb. canister)</td><td>$4.50</td><td><input type="text" name="quanity3" style="width:50px;" placeholder="0"/></td>
    </tr>
    <tr>
    <td>Toffey Nut Popcorn (2 lb. canister)</td><td>$5.00</td><td><input type="text" name="quanity4" style="width:50px;" placeholder="0"/></td>
    </tr>


How can I take the number entered for each quantity and multiply it by a set price to find out how much is being paid? For example, 4 boxes of caramel popcorn for the price of 3.00 would be 12.00.

<html>
<body>
    <p>
	<table border="1">
    <tr>
    <td>Product</td><td>Price</td><td>Quantity Ordered</td> <td>Item</td>
    </tr>
    <tr>
    <td>Unpopped Popcorn (1 lb.)</td><td>$3.00</td> <td><?php echo $_GET['quanity1']; ?></td> <td><?php echo ".$multiplication" ?></td>
    </tr>
    <tr>
    <td>Caramel Popcorn (1 lb. canister)</td><td>$3.50</td><td><?php echo $_GET['quanity2']; ?></td><td>pp</td>
    </tr>
    <tr>
    <td>Caramel Nut Popcorn (2 lb. canister)</td><td>$4.50</td><td><?php echo $_GET['quanity3']; ?></td><td>//</td>
    </tr>
    <tr>
    <td>Toffey Nut Popcorn (2 lb. canister)</td><td>$5.00</td><td><?php echo $_GET['quanity4']; ?></td><td>nn</td>
    </tr>
    </table>
	</p>
	
	<p> </p>
	<p>You ordered popcorn items </p>
	<p>Your total bill is: </p>
	<p>Your chosen method of payment is: <?php echo $_GET['card'] ?> </p>
	
</body>
</html>


Is This A Good Question/Topic? 0
  • +

Replies To: Getting input from textbox in a table

#2 izic  Icon User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 197
  • Joined: 15-January 09

Re: Getting input from textbox in a table

Posted 28 November 2012 - 10:11 PM

Nevermind you can close this topic.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1