hi there! im having a problem with making an order form. i want to display the products from a database and beside the product names, the customer could enter the quantity he wants to order. when the submit button is clicked, there comes the error.
im a newbie in php so i dont know how to resolve the errors. can anyone please help me?? thanks in advance!
here is the code:
<?php
$quantity = $_POST['quantity'];
$prod_desc = $_POST['prod_desc'];
if (!isset($_POST['submit'])) {
global $database;
$sql = 'SELECT * FROM #__products';
$db = $database;
$db->setQuery( $sql );
$rows = $db->loadObjectList();
'<form action="<?php echo $PHP_SELF;?>" method="post">' ;
echo '<table>
<col width="65" />
<col width="300" />
<col width="49" />
<col width="46" />';
echo '<tr><td align="center">'."Product ID".'</td><td align="center">' ."Product Description". '</td><td align="center">' ."Price". '</td><td align="center">'."Quantity".'</td></tr>';
foreach ( $rows as $row ) {
echo '<tr><td align="center">'. $row->prod_id .'</td><td>' . $row->prod_desc . '</td><td align="right">' . $row->prod_price . '</td><td><input name="quantity" type="text" size="5"></td></tr>';
}
echo '<tr><td align="center">'.''.'</td><td align="center">' .''. '</td><td align="center">' .''. '</td><td align="center">'.'<input type="submit" name="submit" value="submit" />'.'</td></tr>';
echo '</table>';
'</form>';
}else{
echo "You ordered ". $quantity . " " . $prod_desc . ".<br />";
echo "Thank you!";
}
?>