[FX.php List] add multiple records with one submit

Derrick Fogle derrick at fogles.net
Mon Sep 22 17:39:59 MDT 2008


Arrays are your friend. You can have a form that does this:

foreach($foundRecords as $key = $value) {  ?>
    <input type="checkbox" name="selections[]" value="<?php echo $key ? 
 >">
<?php } ?>

...and then on the page that processes the form submit:

foreach($_POST['selections'] as $key=> $value) {
    ...do your database insert with the $value info.... (which would  
be the $key data submitted from the form)
}

That's roughly how I do it anyway. If the checkbox is checked, the  
value gets passed as and becomes a cell in the $_POST['selections']  
array. If not, it doesn't get passed. Thus, the foreach loop acts on  
each checked record in the submitted form.

Of course I'm a bonehead, so there are probably better solutions out  
there.



On Sep 22, 2008, at 6:25 PM, Kathy Mohr wrote:

> I've been meaning to ask this question for quite some time but just  
> hadn't
> taken the time to do so.  I have an xserve running Filemaker server  
> 8.5
> and using FX.php.  One of the webpages displays a list of found  
> records.
> I currently have a Select link that the user can click to add each
> individual record to a related table.  What I would like to do is be  
> able
> to have a checkbox associated with each record so that the user can  
> check,
> check, check all the records they want added to the related table  
> and then
> click the submit button.  I've searched and searched for a solution  
> to my
> problem. Can anyone help?
>
> Thank you.
>
> Kathleen Mohr
> Educational Technologist/Professional Development
> North Central Ohio Educational Service Center
> Tiffin Center
> 65 St. Francis Avenue
> Tiffin, Ohio  44883
> 419-447-2929
> kmohr at ncoesc.org
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list


Derrick



More information about the FX.php_List mailing list