I had pasted just the two segments (array and foreach loop) of the page, I do indeed have the <select> tag and stuff 
I'm on localhost, I know it should work as when that was not working I tried just a simple array - foreach and it worked, not sure why this one is not working :\ I will post the full code:
PHP Code:
<?
// /CONTROL/FUNCTIONS.PHP
// Categories
$catarray = array(
"1" => "Dogs",
"2"=>"Cats",
"3"=>"Fish",
"4"=>"Fish->Tropical",
"5"=>"Fish->Salt Water",
"6"=>"Fish->Fresh Water",
"7"=>"Birds",
"8"=>"Reptiles",
"9"=>"Small Animals",
"10"=>"Pet Insurance",
"11"=>"Pet Insurance->Pet Jewelry",
"12"=>"Pet Horoscopes",
"13"=>"Pet Names",
"14"=>"Pet Medications",
"15"=>"Exotic Pets",
"16"=>"Pet Adoption"
);
function PageContent($do) {
if($do=="front") {
echo
'
Welcome to your Endless Pets administration panel. Here you can add, edit, or delete items, and manage categories that those items are placed in. Please select an option from the left to perform. If you have any trouble, please see the <a href="index.php?do=help">help</a> section.
';
} elseif($do=="add") {
echo
'
<form action="index.php?do=process_new" method="post">
Product Name: <br />
<input type="text" name="pname" size="30"> <br />
Product Category: <br />
<select name="pcat">
';
//Populate categories and sub-categories
foreach($catarray AS $key => $value) {
echo
'
<option value="'.$key.'">'.$value.'</option>
';
}
echo
'
</select> <br />
Product Code: <br />
<textarea name="pcode" rows="15" cols="90"></textarea> <br />
<br />
<input type="submit" value="Add This Item">
</form>
';
}
}
edit: ahhh I bet it is because $catarray is not declared in the function, and thus it is treating it like $catarray does not exist...
edit2: yeah, it works now
knew it would be something obvious
Bookmarks