[FX.php List] FMPHP API

Michael Layne fx at 9degrees.com
Fri Jul 28 14:27:08 MDT 2006


This may not be the best way to do it, but if your value list is  
coming from fields in another table, you can also just do another  
query and get the "id" and "description" then use PHP to populate the  
dropdown menu, etc.  I have not had great experience with getting  
"value lists" straight form the FileMaker ones via FX using that  
method.  I find it easier to roll my own.

example...


// 2nd query to display class list
	$qList = new FX($ip, $port);
	$qList->SetDBData($fmdb,$lay . 'classes');
	$qList->SetDBPassword($fmpw[0],$fmpw[1]);		
	$qList->AddDBParam('camp',$camp);
	$rList = $qList->FMFind();

make your dropdown...

<select name="program01Class01">
<option value="" selected>Select...</option>
<?
foreach ($rList['data'] as $l) {
	echo "<option value=\"" . $l['classID'][0] . "\">" . $l['className'] 
[0] . "</option>\n";
}
?>
</select>


if you want to display something already selected - say to edit a  
record...

foreach ($rList['data'] as $l) {
	if ($d['program01Class01'][0] == $l['classID'][0]) {
		echo "<option value=\"" . $l['classID'][0] . "\" selected=\"selected 
\">" . $l['className'][0] . "</option>\n";
		} else {
		echo "<option value=\"" . $l['classID'][0] . "\">" . $l['className'] 
[0] . "</option>\n";
	}
}

// the above will "select" the value from the menu.

HTH,

Michael


On Jul 28, 2006, at 3:59 PM, Andrew Denman wrote:

> Don't know about your first question, but for the second one, it  
> looks like
> you want to break the string on the spaces.  Check out strtok():
> http://us3.php.net/manual/en/function.strtok.php
>
> Andrew Denman
>
> -----Original Message-----
> From: fx.php_list-bounces at mail.iviking.org
> [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of AC
> Sent: Friday, July 28, 2006 2:51 PM
> To: FX.php Discussion List
> Subject: [FX.php List] FMPHP API
>
> Anyone know if this API will grab both value fields from value lists
> that are based on 2 fields ex.
> The "Company" value list uses the fields "IDCompany" and  
> "CompanyName".
> In FX only the IDCompany is returned.
> Does this API return both values?
>
>
>
> Also, assuming I had   MyVariable = "316 Dell"
> I can use the function    strstr(MyVariable, " ")
> to get the "Dell" part by itself but to get the 316 I'm currently  
> doing
>    substr(MyVariable, 0, strcspn(MyVariable, " "))
> Is there an easier way to get the 316 by itself (assuming it could  
> also
> be text)?
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list


Michael Layne  |  9 degrees development  |  www.9degrees.com  |   
404.226.7835  |   Skype: LayneBay


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20060728/2cab5966/attachment-0001.html


More information about the FX.php_List mailing list