PHP MySQL: How did allrecipes.com make display the ingredients in a list?

yecalrae

New member
I signed up to see if I could get a hint as to how they displayed the ingredients in a list, but I'm not sure as of now. When a user submits a recipe, they type it into a textarea separating each ingredient with a comma. So how did they display the ingredients as a list?
 
$list = explode(",", $ingredients);

split up each item and put into array $list

then i would use a foreach loop to list each of the item in the array

echo "<ul>";
foreach ($list as $item) {
echo "<il>$item</il>";
}
echo "</ul>";
 
Back
Top