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

Tim 'Webko' Booth tim at nicheit.com.au
Mon Sep 22 17:41:55 MDT 2008


Dear Kathy,

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

Yes.

Create the checkboxes, and name them in the form <input  
type="checkbox" name="check[]" value="value1">

This means that the submitted values will be in an array, so you can  
then loop through them to add the related records to the subtable.

Something like:

	$addRecord = $_POST['check'];
	//Add records from new aray
	foreach($addRecord as $key => $value) {
		$addRecordObj=new FX($dbHost,$port,$dbType,$conType);
		$addRecordObj -> setDBPassword($dbPass,$dbUser);
		$addRecordObj -> setDBData($dbName,'SubTable');
		$addRecordObj -> AddDBParam('_Record_ID', $value);
		$addRecordData = $addRecordObj -> FMNew();
	}

Gets more tricky of you want to add a record with more than one piece  
of data...

HTH

Webko



More information about the FX.php_List mailing list