Re: [PHP] problem with foreach

2007-10-23 Thread Andrew Ballard
On 10/23/07, tedd <[EMAIL PROTECTED]> wrote: > At 12:01 PM -0500 10/22/07, Adam Williams wrote: > >I have an html page with checkboxes: > > > > > >Modern > >Mississippi > >Civil Rights > >MilitaryHistory > > > > > >and mailform2.php containing: > > > >echo "you selected: "; > >/* line 81 */ foreach

Re: [PHP] problem with foreach

2007-10-23 Thread tedd
At 12:01 PM -0500 10/22/07, Adam Williams wrote: I have an html page with checkboxes: Modern Mississippi Civil Rights MilitaryHistory and mailform2.php containing: echo "you selected: "; /* line 81 */ foreach ($_POST[option] as $a) { echo "$a"; } but I'm getting the

RE: [PHP] problem with foreach

2007-10-22 Thread Robert Cummings
On Mon, 2007-10-22 at 19:59 -0400, Bastien Koert wrote: > I am sure that I am late to the party, but am sure that > double or single quotes at least are needed around the > attribute values to make this work Late to the party and completely off the mark taboot. Don't need quotes at all. It's bad p

RE: [PHP] problem with foreach

2007-10-22 Thread Bastien Koert
; CC: php-general@lists.php.net> Subject: Re: [PHP] problem with foreach>>>> Robert Cummings wrote:>> On Mon, 2007-10-22 at 18:07 +0100, Stut wrote:>>>>> Adam Williams wrote:>>>>>>> I have an html page with checkboxes:>>>>>>&

Re: [PHP] problem with foreach

2007-10-22 Thread Greg Donald
On 10/22/07, Nathan Hawks <[EMAIL PROTECTED]> wrote: > Also, AFAIK, PHP has always thrown a warning or notice if you use > foreach() on a non-associative array. PHP arrays are always associative: > cat array.php #!/usr/bin/env php ./array.php Array ( [0] => 1 [1] => 2 [2] => 3 ) Array (

Re: [PHP] problem with foreach

2007-10-22 Thread Nathan Hawks
Also, AFAIK, PHP has always thrown a warning or notice if you use foreach() on a non-associative array. That doesn't mean it won't work, but the strict standard is apparently: foreach ($assoc as $key => $val) not foreach ($indexed as $item) However, as we all know, the latter still works fine.

Re: [PHP] problem with foreach

2007-10-22 Thread Philip Thompson
On 10/22/07, Adam Williams <[EMAIL PROTECTED]> wrote: > > I have an html page with checkboxes: > > > Modern > Mississippi Change to: ... Someone mentioned this earlier, but I thought I'd reiterate. I'm not sure how the browser will deal with *arrays* that aren't quoted. It's very good practice

Re: [PHP] problem with foreach

2007-10-22 Thread Stut
Robert Cummings wrote: On Mon, 2007-10-22 at 18:07 +0100, Stut wrote: Adam Williams wrote: I have an html page with checkboxes: Modern Mississippi Civil Rights MilitaryHistory and mailform2.php containing: echo "you selected: "; /* line 81 */ foreach ($_POST[option] as $a) {

Re: [PHP] problem with foreach

2007-10-22 Thread Ludovic André
Adam Williams a écrit : I have an html page with checkboxes: [...] but I'm getting the error: you selected: *Warning*: Invalid argument supplied for foreach() in */var/www/sites/mdah-test/museum/mmhsurvey/mailform2.php* on line *81* I googled some checkbox/foreach pages on google, but I don'

Re: [PHP] problem with foreach

2007-10-22 Thread Robert Cummings
On Mon, 2007-10-22 at 12:20 -0500, Adam Williams wrote: > > Yeah, thats the problem I'm having for some reason. When I do: > > print_r($_POST['option']); > > it prints nothing. It's usually more informative to see everything that was posted so you might have more of an idea what may have went

RE: [PHP] problem with foreach

2007-10-22 Thread Jay Blanchard
[snip] print_r($_POST['option']); it prints nothing. [/snip] Try resetting the array first, you may be at the end of the array; reset($_POST); print_r($_POST); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] problem with foreach

2007-10-22 Thread Adam Williams
Robert Cummings wrote: On Mon, 2007-10-22 at 18:07 +0100, Stut wrote: Adam Williams wrote: I have an html page with checkboxes: Modern Mississippi Civil Rights MilitaryHistory and mailform2.php containing: echo "you selected: "; /* line 81 */ foreach ($_POST[option] as $a)

Re: [PHP] problem with foreach

2007-10-22 Thread Robert Cummings
On Mon, 2007-10-22 at 18:07 +0100, Stut wrote: > Adam Williams wrote: > > I have an html page with checkboxes: > > > > > > Modern > > Mississippi > > Civil Rights > > MilitaryHistory > > > > > > and mailform2.php containing: > > > > echo "you selected: "; > > /* line 81 */ foreach ($_POST[opt

Re: [PHP] problem with foreach

2007-10-22 Thread Andrew Ballard
On 10/22/07, Adam Williams <[EMAIL PROTECTED]> wrote: > I have an html page with checkboxes: > > > Modern > Mississippi > Civil Rights > MilitaryHistory > > > and mailform2.php containing: > > echo "you selected: "; > /* line 81 */ foreach ($_POST[option] as $a) > { > echo "$a"; >

Re: [PHP] problem with foreach

2007-10-22 Thread Stut
Adam Williams wrote: I have an html page with checkboxes: Modern Mississippi Civil Rights MilitaryHistory and mailform2.php containing: echo "you selected: "; /* line 81 */ foreach ($_POST[option] as $a) { echo "$a"; } but I'm getting the error: you selected: *Warn

Re: [PHP] problem with foreach

2007-10-22 Thread Jason Pruim
On Oct 22, 2007, at 1:01 PM, Adam Williams wrote: I have an html page with checkboxes: Modern Mississippi Civil Rights MilitaryHistory and mailform2.php containing: echo "you selected: "; /* line 81 */ foreach ($_POST[option] as $a) { echo "$a"; } but I'm getting t