Re: Variables in forms

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

 



Can you send us some of the code so we would be able to help you?

On 23/06/2008, Ron Piggott <ron.php@xxxxxxxxxxxxxxxxxx> wrote:
>
>
> Jim what you sent is very helpful.
>
> I had an error message when I submitted the form with a POST
>
> your_cleaning_function
>
> gave me this error:
>
> Fatal error: Call to undefined function: your_cleaning_function()
>
> I am trying to save the ones that were checked to a mySQL table and then
> notify the user the database was updated.  The first thing that happens
> is the code you gave me below.  How do I resolve this error?  I get the
> concept of functions, but this isn't an area of PHP that I have used
> before.
>
> Ron
>
> On Sun, 2008-06-22 at 23:40 -0700, Jim Lucas wrote:
> > Ron Piggott wrote:
> > > I am writing a form right now.
> > >
> > > I would like to make the checkbox an array variable.  The first part of
> > > the array is the component reference, the second part is the package
> > > reference.  What name would you assign to it that I could use in
> > > processing the form in the PHP script this posts to?
> > >
> > > Ron
> > >
> > > <tr>
> > > <td valign="top"><font face="times new roman"><center>Children's
> Activities</center></td>
> > > <td valign="top"><font face="times new roman"><center>Child's
> ABC's</center></td>
> > > <td><center><input type="checkbox"
> name="component_1_package_1"></center></td>
> > > <td><center><input type="checkbox"
> name="component_1_package_2"></center></td>
> > > </tr>
> > >
> > >
> >
> > In your form, do this
> >
> > <input type="checkbox" name="components[1][1]">
> > <input type="checkbox" name="components[1][2]">
> >
> >
> >
> > Then in PHP do this.  This is if the form was sent via POST
> >
> > <?php
> >
> > $components = your_cleaning_function($_POST['components']);
> >
> > foreach ( $components AS $component_id => $packages ) {
> >      foreach ( $packages AS $package_id => $value ) {
> >          // At this point, the only way you would get here is if
> >          // a person was to place a check mark in the check box
> >          // So, one would assume that this component/package
> >          // combo was infact checked.
> >      }
> > }
> >
> > ?>
> >
>
>
> --
> 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