Re: foreach question
| From: | siavash1979 at telus dot net | Date: | Mon, 09 Apr 2007 04:03:15 +0000 |
| Subject: | Re: foreach question | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252284@lists.php.net to get a copy of this message | ||
Your code is fine and it should work.
but in any case, try:
foreach ($_POST as $key){
echo $key . '<br />';
}
Also, what php version, and what browser are you using?
good luck,
Siavash
> chris@aquanuke.com wrote:
> > "both examples do the same thing.."
> >
> > no, ex1 only has 1 <br />
> >
> > so outputs like..
> > item1item2item3item4item5<br />
> >
> > Where as I want this..
> >
> > item1<br />
> > item2<br />
> > item3<br />
> > item4<br />
> > item5<br />
> >
> > ie a line break after every item.
> >
>
> hmm, if you're getting 5 results from the loop each should already have
> a <br />
> so i dont understand what is wrong but the code it's set to put out a
> line break after each item. maybe i'm blind but the code is fine (with
> the exception that i don't use double quotes).
> >
> > ----- Original Message ----- From: "Sebe" <sebastian@dslr.net>
> > To: <chris@aquanuke.com>
> > Cc: <php-general@lists.php.net>
> > Sent: Monday, April 09, 2007 1:22 AM
> > Subject: Re: [PHP] foreach question
> >
> >
> >> chris@aquanuke.com wrote:
> >>> I have ..
> >>>
> >>> foreach( $_POST as $key ) { echo "$key<br />";
> >>> }
> >>>
> >>> and that gives me
> >>>
> >>> item1
> >>> item2
> >>> item3
> >>> item4
> >>> item5<br />
> >>>
> >>> how do I write it to give me
> >>>
> >>> item1<br />
> >>> item2<br />
> >>> item3<br />
> >>> item4<br />
> >>> item5<br />
> >>>
> >>> Thanks
> >>>
> >> both examples do the same thing..
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>