You are here: Re: foreach loop contains arrays in some values « PHP Programming Language « IT news, forums, messages
Re: foreach loop contains arrays in some values

Posted by Robin on 04/15/06 01:55

Try another foreach, e.g.

foreach($_POST as $key => $value)
{
if(is_array($value))
{
foreach($value as ...)
{...}
}
else
{...}
}

Jack E Leonard wrote:
> I'm looping through the keys and values of a form submission using
>
> foreach($_POST as $key => $value)
> echo "$key = $value<br>";
>
> No problems there. All works as expected. But seveal of the values are
> arrays and the echo comes out like:
>
> subjectone = Array
> subjecttwo = Array
>
> There could be as many as 9 elements in each array but there may be as
> few as one. How can I get those $value that are arrays to echo the
> entire array using a foreach loop? I would like to end up with all
> values printed in the page whether in an array or not.
>
> Thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация