RE: PHP Post & forms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx] 
Sent: Friday, April 14, 2006 11:44 AM
To: php-general@xxxxxxxxxxxxx
Cc: Stephen Johnson; Gary E. Terry
Subject: Re:  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@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxx

--
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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux