A form and an array
am 24.07.2009 06:01:10 von Jason Carson
Hello everyone,
Lets say I have a file called form.php with the following form on it that
redirects to index.php when submitted. I would like to take the values of
the text fields in the form and put them into an array, then be able to
display the values in that array on index.php Does anyone know how I would
do that?
Here is my form...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: A form and an array
am 24.07.2009 06:10:02 von David Robley
Jason Carson wrote:
> Hello everyone,
>
> Lets say I have a file called form.php with the following form on it that
> redirects to index.php when submitted. I would like to take the values of
> the text fields in the form and put them into an array, then be able to
> display the values in that array on index.php Does anyone know how I would
> do that?
>
> Here is my form...
>
>
You'll find they are already in an array which you can access as
$_POST['option'] - from there foreach() should be the next step.
Cheers
--
David Robley
Polls show that 9 out of 6 schizophrenics agree.
Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: A form and an array
am 24.07.2009 06:16:35 von Jason Carson
> Jason Carson wrote:
>
>> Hello everyone,
>>
>> Lets say I have a file called form.php with the following form on it
>> that
>> redirects to index.php when submitted. I would like to take the values
>> of
>> the text fields in the form and put them into an array, then be able to
>> display the values in that array on index.php Does anyone know how I
>> would
>> do that?
>>
>> Here is my form...
>>
>>
>
> You'll find they are already in an array which you can access as
> $_POST['option'] - from there foreach() should be the next step.
>
>
> Cheers
> --
> David Robley
>
> Polls show that 9 out of 6 schizophrenics agree.
> Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I am new to programming. How would I use foreach()to display the entries
in the array?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: A form and an array
am 24.07.2009 06:24:47 von David Robley
Jason Carson wrote:
>> Jason Carson wrote:
>>
>>> Hello everyone,
>>>
>>> Lets say I have a file called form.php with the following form on it
>>> that
>>> redirects to index.php when submitted. I would like to take the values
>>> of
>>> the text fields in the form and put them into an array, then be able to
>>> display the values in that array on index.php Does anyone know how I
>>> would
>>> do that?
>>>
>>> Here is my form...
>>>
>>>
>>
>> You'll find they are already in an array which you can access as
>> $_POST['option'] - from there foreach() should be the next step.
>>
>>
>> Cheers
>> --
>> David Robley
>>
>> Polls show that 9 out of 6 schizophrenics agree.
>> Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> I am new to programming. How would I use foreach()to display the entries
> in the array?
You could read TFM which has an example -
http://php.net/manual/en/control-structures.foreach.php
Cheers
--
David Robley
Why are you wasting time reading taglines?
Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: A form and an array
am 24.07.2009 06:33:03 von Jason Carson
> Jason Carson wrote:
>
>>> Jason Carson wrote:
>>>
>>>> Hello everyone,
>>>>
>>>> Lets say I have a file called form.php with the following form on it
>>>> that
>>>> redirects to index.php when submitted. I would like to take the values
>>>> of
>>>> the text fields in the form and put them into an array, then be able
>>>> to
>>>> display the values in that array on index.php Does anyone know how I
>>>> would
>>>> do that?
>>>>
>>>> Here is my form...
>>>>
>>>>
>>>
>>> You'll find they are already in an array which you can access as
>>> $_POST['option'] - from there foreach() should be the next step.
>>>
>>>
>>> Cheers
>>> --
>>> David Robley
>>>
>>> Polls show that 9 out of 6 schizophrenics agree.
>>> Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>> I am new to programming. How would I use foreach()to display the entries
>> in the array?
>
> You could read TFM which has an example -
> http://php.net/manual/en/control-structures.foreach.php
>
>
> Cheers
> --
> David Robley
>
> Why are you wasting time reading taglines?
> Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
What I currently have is...
foreach ($_POST['option'] as $value) {
echo "Value: $value
\n";
}
....but that doesn't work. TFM didn't help me :-(
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re: A form and an array
am 24.07.2009 06:50:38 von Warren Vail
Did you correct the missing double quote in your sending form first?
Warren Vail
-----Original Message-----
From: Jason Carson [mailto:jason@jasoncarson.ca]
Sent: Thursday, July 23, 2009 9:33 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Re: A form and an array
> Jason Carson wrote:
>
>>> Jason Carson wrote:
>>>
>>>> Hello everyone,
>>>>
>>>> Lets say I have a file called form.php with the following form on it
>>>> that
>>>> redirects to index.php when submitted. I would like to take the values
>>>> of
>>>> the text fields in the form and put them into an array, then be able
>>>> to
>>>> display the values in that array on index.php Does anyone know how I
>>>> would
>>>> do that?
>>>>
>>>> Here is my form...
>>>>
>>>>
>>>
>>> You'll find they are already in an array which you can access as
>>> $_POST['option'] - from there foreach() should be the next step.
>>>
>>>
>>> Cheers
>>> --
>>> David Robley
>>>
>>> Polls show that 9 out of 6 schizophrenics agree.
>>> Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>> I am new to programming. How would I use foreach()to display the entries
>> in the array?
>
> You could read TFM which has an example -
> http://php.net/manual/en/control-structures.foreach.php
>
>
> Cheers
> --
> David Robley
>
> Why are you wasting time reading taglines?
> Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
What I currently have is...
foreach ($_POST['option'] as $value) {
echo "Value: $value
\n";
}
....but that doesn't work. TFM didn't help me :-(
--
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
RE: Re: A form and an array
am 24.07.2009 07:04:52 von Jason Carson
Yes
> Did you correct the missing double quote in your sending form first?
>
> Warren Vail
>
> -----Original Message-----
> From: Jason Carson [mailto:jason@jasoncarson.ca]
> Sent: Thursday, July 23, 2009 9:33 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Re: A form and an array
>
>> Jason Carson wrote:
>>
>>>> Jason Carson wrote:
>>>>
>>>>> Hello everyone,
>>>>>
>>>>> Lets say I have a file called form.php with the following form on it
>>>>> that
>>>>> redirects to index.php when submitted. I would like to take the
>>>>> values
>>>>> of
>>>>> the text fields in the form and put them into an array, then be able
>>>>> to
>>>>> display the values in that array on index.php Does anyone know how I
>>>>> would
>>>>> do that?
>>>>>
>>>>> Here is my form...
>>>>>
>>>>>
>>>>
>>>> You'll find they are already in an array which you can access as
>>>> $_POST['option'] - from there foreach() should be the next step.
>>>>
>>>>
>>>> Cheers
>>>> --
>>>> David Robley
>>>>
>>>> Polls show that 9 out of 6 schizophrenics agree.
>>>> Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
>>>>
>>>>
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>> I am new to programming. How would I use foreach()to display the
>>> entries
>>> in the array?
>>
>> You could read TFM which has an example -
>> http://php.net/manual/en/control-structures.foreach.php
>>
>>
>> Cheers
>> --
>> David Robley
>>
>> Why are you wasting time reading taglines?
>> Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> What I currently have is...
>
> foreach ($_POST['option'] as $value) {
> echo "Value: $value
\n";
> }
>
> ...but that doesn't work. TFM didn't help me :-(
>
>
> --
> 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
Re: Re: A form and an array
am 24.07.2009 07:11:30 von dengxule
--00163646c6f4233d30046f6ca3be
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
In php.ini turn the "display_errors" to "on".
If any error,warn or notice shown,copy them and paste here.
So you can tell us what doesn't work.
good luck~
2009/7/24 Jason Carson
> > Jason Carson wrote:
> >
> >>> Jason Carson wrote:
> >>>
> >>>> Hello everyone,
> >>>>
> >>>> Lets say I have a file called form.php with the following form on it
> >>>> that
> >>>> redirects to index.php when submitted. I would like to take the values
> >>>> of
> >>>> the text fields in the form and put them into an array, then be able
> >>>> to
> >>>> display the values in that array on index.php Does anyone know how I
> >>>> would
> >>>> do that?
> >>>>
> >>>> Here is my form...
> >>>>
> >>>>
> >>>
> >>> You'll find they are already in an array which you can access as
> >>> $_POST['option'] - from there foreach() should be the next step.
> >>>
> >>>
> >>> Cheers
> >>> --
> >>> David Robley
> >>>
> >>> Polls show that 9 out of 6 schizophrenics agree.
> >>> Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
> >>>
> >>>
> >>> --
> >>> PHP General Mailing List (http://www.php.net/)
> >>> To unsubscribe, visit: http://www.php.net/unsub.php
> >>>
> >>>
> >> I am new to programming. How would I use foreach()to display the entries
> >> in the array?
> >
> > You could read TFM which has an example -
> > http://php.net/manual/en/control-structures.foreach.php
> >
> >
> > Cheers
> > --
> > David Robley
> >
> > Why are you wasting time reading taglines?
> > Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> What I currently have is...
>
> foreach ($_POST['option'] as $value) {
> echo "Value: $value
\n";
> }
>
> ...but that doesn't work. TFM didn't help me :-(
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--00163646c6f4233d30046f6ca3be--
Re: Re: A form and an array
am 24.07.2009 07:24:40 von Jason Carson
I have it working now. I had a comma where a semicolon should have been.
Silly error on my part but thanks to everyone who tried to help me.
> In php.ini turn the "display_errors" to "on".
> If any error,warn or notice shown,copy them and paste here.
> So you can tell us what doesn't work.
>
> good luck~
>
> 2009/7/24 Jason Carson
>
>> > Jason Carson wrote:
>> >
>> >>> Jason Carson wrote:
>> >>>
>> >>>> Hello everyone,
>> >>>>
>> >>>> Lets say I have a file called form.php with the following form on
>> it
>> >>>> that
>> >>>> redirects to index.php when submitted. I would like to take the
>> values
>> >>>> of
>> >>>> the text fields in the form and put them into an array, then be
>> able
>> >>>> to
>> >>>> display the values in that array on index.php Does anyone know how
>> I
>> >>>> would
>> >>>> do that?
>> >>>>
>> >>>> Here is my form...
>> >>>>
>> >>>>
>> >>>
>> >>> You'll find they are already in an array which you can access as
>> >>> $_POST['option'] - from there foreach() should be the next step.
>> >>>
>> >>>
>> >>> Cheers
>> >>> --
>> >>> David Robley
>> >>>
>> >>> Polls show that 9 out of 6 schizophrenics agree.
>> >>> Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
>> >>>
>> >>>
>> >>> --
>> >>> PHP General Mailing List (http://www.php.net/)
>> >>> To unsubscribe, visit: http://www.php.net/unsub.php
>> >>>
>> >>>
>> >> I am new to programming. How would I use foreach()to display the
>> entries
>> >> in the array?
>> >
>> > You could read TFM which has an example -
>> > http://php.net/manual/en/control-structures.foreach.php
>> >
>> >
>> > Cheers
>> > --
>> > David Robley
>> >
>> > Why are you wasting time reading taglines?
>> > Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
>> >
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>> What I currently have is...
>>
>> foreach ($_POST['option'] as $value) {
>> echo "Value: $value
\n";
>> }
>>
>> ...but that doesn't work. TFM didn't help me :-(
>>
>>
>> --
>> 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