Jump to content

Invalid argument supplied for foreach()


munky334

Recommended Posts

Hi there

 

The following script wont run , I get the error below. Any advice?

 

Warning - Invalid argument supplied for foreach() - Line 36

 

Thanking you in advance

<?php
/* File: shop_page_index.inc
* Desc: Displays the categories for the catalog.
*/
?>
<html>
<head><title>The Furniture Shop</title>
<style type='text/css'>
<!--
ul li {
list-style: none;
font-weight: bold;
padding-top: .5em;
font-size: 1.2em;
}
ul li.level2 {
margin-left: -1em;
font-weight: normal;
font-size: .9em;
}
-->
</style>
</head>
<body style="margin: .2in">
<?php
/* Display text before form */
echo "<form action='Shop_cart.php' method='POST'>\n 
<p style='text-align: right'>\n
<input type='submit' value='View Shopping Cart'>\n
</form>\n"; 
echo "<h1 style='text-align: center'>The Furniture Shop</h1>
<hr>";
/* Create form containing selection list */
echo "<form action='$_SERVER[php_SELF]' method='POST'>\n";
echo "<ul>\n";
foreach($furn_categories as $key => $subarray)
{
echo "<li>$key</li>\n";
echo "<ul>\n";
foreach($subarray as $type)
{
echo "<li class='level2'>
<input type='radio' name='interest'
id='$type' value='$type'>
<label for='$type'>$type</label></li>\n";
} // end foreach type
echo "</ul>\n";
} //end foreach category
echo "</ul>";
echo "<input type='submit' name='Products'
value='Select Category' style='margin-left: .5in’>\n";
echo "</form>\n";
?>
<hr>
</body></html>

EDIT: code tags code tags code tags

Link to comment
https://forums.phpfreaks.com/topic/129062-invalid-argument-supplied-for-foreach/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.