Bricktop Posted August 3, 2009 Share Posted August 3, 2009 Hi all, I have an array and some code to build a select box from that array, however I keep getting: Warning: Invalid argument supplied for foreach() in NAMEOFFILE.php on line XXX My code is as follows: $domaintypes = array( ".com" =>".com", ".co.uk" =>".co.uk", ".net" =>".net", ".org" =>".org" ); $content .='<select name="tld">'; foreach($domaintypes as $key => $value){ $content .= '<option value="'.$key.'">'.$value.'</option>'; } $content .='</select>'; echo $content; Any ideas where I've gone wrong? Thanks Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted August 3, 2009 Share Posted August 3, 2009 My code is as follows: No it isn't. That code cannot result in that error. Quote Link to comment Share on other sites More sharing options...
Bricktop Posted August 3, 2009 Author Share Posted August 3, 2009 You're correct, it's working now. When I pasted the code here I did delete a couple of unneeded " marks, I that's obviously what was causing the problem. Many thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.