FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » option values with php foreach not working
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: option values with php foreach not working [message #171138 is a reply to message #171112] Mon, 27 December 2010 12:25 Go to previous message
tony is currently offline  tony
Messages: 19
Registered: December 2010
Karma:
Junior Member
In article <1fvzvt4txaqp2(dot)dlg(at)evanplatt(dot)sux>,
richard <member(at)newsguy(dot)com> wrote:
> When I run this code locally I get, in firefox, a listbox with "adam" as
> the only output. Nothing else. The second array doesn't even show.
>
> In IE, both items show but I get a warning saying "invalid argument -
> foreach".
> The second array shows up after the warning.
>
> What am I missing?

This is the problem line:

> $myArray="(1,2,3,4,5)";

That doesn't put an array into $myArray, but just a string.
What you need is this:

$myArray = array(1,2,3,4,5);

Cheers
Tony
--
Tony Mountifield
Work: tony(at)softins(dot)co(dot)uk - http://www.softins.co.uk
Play: tony(at)mountifield(dot)org - http://tony.mountifield.org
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Stats comp.lang.php (last 7 days)
Next Topic: Slowly coming together
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 08:27:01 GMT 2024

Total time taken to generate the page: 0.04022 seconds