Re: HTTP_Clients and Files - Part 2
| From: | Justin Patrin | Date: | Wed, 17 Nov 2004 22:46:50 +0000 |
| Subject: | Re: HTTP_Clients and Files - Part 2 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15615@lists.php.net to get a copy of this message | ||
On Wed, 17 Nov 2004 17:15:38 -0500, Andrew Nagy <asnagy@webitecture.org> wrote:
>
>
> Justin Patrin wrote:
> > On Wed, 17 Nov 2004 15:12:33 -0500, Andrew Nagy <asnagy@webitecture.org> wrote:
> >
> >>Justin Patrin wrote:
> >>
> >>
> >>
> >>>On Wed, 17 Nov 2004 12:12:38 -0500, Andrew Nagy <asnagy@webitecture.org>
> >>>wrote:
> >>>
> >>>>Anyway, my new question is how do i send an array of data in a post or
> >>>>get method? For example, if the form that I am submitting to has a set
> >>>>of checkboxes that are all the same name.
> >>>>
> >>>>$client->post($url, array('sessionid' => 'abc123',
> >>>>'options' =>
> >>>>array('1', '3', '7')));
> >>>>
> >>>
> >>>
> >>>Hmmm... It's not really HTML compliant to have multiple checkboxes
> >>>with the same name. It *is* possible with HTTP_Request using
> >>>addRawPostData. I don't know if it's possible with HTTP_Client.
> >>>
> >>
> >>Sure it is. Take a look at:
> >>http://www.w3.org/TR/html4/interact/forms.html#checkbox
> >>
> >>"Several checkboxes in a form may share the same control name. Thus, for
> >>example, checkboxes allow users to select several values for the same
> >>property. The INPUT element is used to create a checkbox control."
> >
> >
> > Hmmm..is it valid for XHTML?
> >
>
> I would assume so. Have you never done this before? It's a very common
> practice.
>
Well, with XHTML the input elements *should* use "id" instead of
"name" and since ids must be unique this wouldn't be valid. In
addition, languages such as PHP won't give you all of the values, just
the last one.
--
Justin Patrin