daredevil88 Posted April 20, 2007 Share Posted April 20, 2007 Hi all, I am writing a shopping cart program. the flow is when customer select one product, it retrieves from database and show item description on screen and allow to enter the quantity customer want. so i wrote a funtion to retreive data from database and another funtion to display. in the display I would like to add an input so that user can add an quantity they want. but how can I pass the value of product_id and input quantity and how do I continue to manipulate the data. if (is_array($product) ) { print "<table width=80% cellpadding=5>"; print "<tr bgcolor='c6effy' align= center>\n"; print "<td><b> Product Name </b></td>"; print "<td><b> Unit Price </b></td>"; print "<td><b> Unit Quantity </b></td>"; print "<td><b> Quantity to buy </b></td>"; print "</tr>"; print "<tr>\n"; print "<td align='left'>$product[product_name]</td>"; printf ("<td align='right'> $%0.2f </td>",$product[unit_price]); print "<td align='right'> $product[unit_quantity]</td>"; print "<td align='center'><input type = 'text' name = 'quantity' value = '1' size = 2></td>"; print "</tr>"; print "</table>"; } Can I send the value like a form? and please let me know how? Link to comment https://forums.phpfreaks.com/topic/47965-how-can-i-let-user-to-add-no-of-quantity-they-want-display-at-the-same-time/ Share on other sites More sharing options...
dustinnoe Posted April 21, 2007 Share Posted April 21, 2007 I know this has nothing to do with your question but get rid of all those print statements and wrap it all in one echo. It will save you lots on script execution time not to mention readability. Link to comment https://forums.phpfreaks.com/topic/47965-how-can-i-let-user-to-add-no-of-quantity-they-want-display-at-the-same-time/#findComment-234381 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.