Okay so I have a for loop that displays books and their associated sales info...I have it displaying correctly..I have a for loop that goes through an array and displays the information. What I would like to do is have the for loop only display information about a hardcover book or a softcover book, if their values are only more that 0; I have tried putting a for loop in the echo statement but it's giving me an error.. I have a feeling it has to do with the way am concatinating the values..anyway here is my for loop
function displayData($array){
// create a form
echo ' <form action="order_summary.php" method="post">';
// for loop to go through data
for($row = 0; $row < sizeof($array);$row++){
echo '<div class="book-details"><img src="images/' .
$array[$row]['isbn'].'.jpg" alt="'.$array[$row]['title'] .'" >'.
'<br/>'.$array[$row]['title'].'<br/>by '.$array[$row]['author'].
'<br/><input type="radio" name="orders['.$array[$row]['title'].
']" value="hardcover" >Hardcover: $'.$array[$row]['hardcover'].
'<br/><input type="radio" name="orders['.$array[$row]['title'].
']" value="softcover" >Softcover: $'.$array[$row]['softcover'].
'<br/><input type="radio" name="orders['.$array[$row]['title'].
']" value="e-book" >E-Book: $'.$array[$row]['e-book']."</div>";
};
echo '<div class = "cart"><input type="submit" value="Add Selected Items to Cart"></div>';
echo '</form>';
}// end of function
I would like to include something like this
if (!$array[$row]['hc-quantity']== 0) {
// display hardcover price
}
else {
go to the next book and repeat check for softcover
};
can you please help me work this out...