RE: [PHP] PHP Post & forms
| From: | Gary E. Terry | Date: | Fri, 14 Apr 2006 16:08:19 +0000 |
| Subject: | RE: [PHP] PHP Post & forms | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-233996@lists.php.net to get a copy of this message | ||
Sorry, should have posted lastnight.. Stephen Johnson helped out a lot,
it's working great now.
Thanks for the relpy though
-----Original Message-----
From: Joe Henry [mailto:jhenry@celebrityaccess.com]
Sent: Friday, April 14, 2006 11:44 AM
To: php-general@lists.php.net
Cc: Stephen Johnson; Gary E. Terry
Subject: Re: [PHP] PHP Post & forms
On Thursday 13 April 2006 8:44 pm, Stephen Johnson wrote:
> On 4/13/06 7:40 PM, "Gary E. Terry" <terry@quickinet.net> wrote:
> > Quite possibly a stupid question, but here goes.
> >
> > I have a form that is a list of jobs. On that list is a checkbox.
> > The form field is named 'changedate'.
> >
> > I also have a hidden field called 'JobID'.
> >
> > What I am trying to accomplish is if a checkbox is checked, when the
> > form is submitted, I want all of the JobID's to be updated by an SQL
> > query.
> >
> > But it seems to me that $_POST will only contain the last JobID in
> > the form, no matter what. Am I correct on this?
> >
> > Is what I am trying to accomplish not possible with a form post?
> >
> > I think I remember doing something similar with Cold Fusion years
> > ago, but I have never attempted this with PHP.
> >
> > Any suggestions?
>
> You need to pass the checkboxes as an array value with the JobID as
> the identifier.
>
> Then on the other side, you can run through the list of JobID's and
> see which ones need to be updated.
>
If I'm understanding what you're asking, you have an array of checkboxes
whose values you want passed to you PHP via the $_POST array. The HTML form
syntax would be something like:
<input type="checkbox" name="array[]" value="..." /> <input
type="checkbox"
name="array[]" value="..." /> <input type="checkbox"
name="array[]"
value="..." /> etc.
Then in your PHP script, $_POST['array'] will hold an array of the checkbox
values.
HTH
--
Joe Henry
www.celebrityaccess.com
jhenry@celebrityaccess.com
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php