I am getting a list of results from a SQL query and trying to figure out how to add them to a list. There is a text field for users to enter a quantity and an “add to list” button. I am stuck on how to add the items in the loop to a list which can then be inserted into the body of an email. Anyone shed some light on this for me? Thanks in advance!
Code:
if(mysql_num_rows($raw_results) > 0){ // if one or more rows are returned do following
$i = "1";
while($results = mysql_fetch_array($raw_results)){
echo "<h3><div id='$i'>Product ID: ".$results['PID']."</div></h3>";
echo "<p>Description: ".$results['Description']."</p>";
echo "<p>Quantity: ".$results['Quantity']."</p>";
echo "<p>Location: ".$results['Location']."</p>";
// echo "<p>Link: ".$results['DataSheetLink']."</p>";
if(!empty($results['DataSheetLink']))
echo '<p>Data Sheet Link: <a href="'.$results['DataSheetLink'].'">Click Here</a></p>';
echo "<a href='mailto:<email>?subject=Part Request: ".$results['PID']."&body=I would like to request (enter quantity of this item) of PID ".$results['PID']." - ".$results['Description']." '>Request Item</a><br><br>";
echo "<form>";
echo "<input type='text' id='qty$i' value='' placeholder='Quantity' width='50px' />";
echo '<button name="add_to_cart" value="'.$results['PID'].'" type="submit">Add to List</button><br>';
echo "</form>";
echo "<hr>";
$i++;
}