[FX.php List] How do I pass multi select items to FM

Erik Andreas Cayré erik at cayre.dk
Fri May 4 14:44:29 MDT 2007


Den 03/05/2007 kl. 7.01 skrev Larry Schultz:

> Gjermund,
> Thank you for the reply. I believe it does have something to do  
> with imploding the array, but I can't get it to work. I am using  
> two pages to do this. The first is the add.php page, and the second  
> is the add_results.php page.
>
> Adding the code you suggested (code) I still create a new FM record  
> on Submit, however no fields get posted!
>
> Got Clues?
>
> TIA,
> Larry
>
> in the add.php page I've done this: (I pulled a lot of fields to  
> make it shorter for this post) Also the red lines are where I added  
> your code.
// snip

This is fine:
> 			<select multiple="true" id="Language_you_translate_fromID"  
> name="Language_you_translate_from[]">
// snip

> in the add_results.php page I've done this: (I pulled a lot of  
> fields to make it shorter for this post)
> <?php require_once('../Connections/PeritusFX.php'); ?>
>
> <?php
> $add_result_add = clone($PeritusFX);
> $add_result_add->layout = 'NewTranslatorOnlineProfile_Web';
> $add_result_fields = array('NameFirst'=>$_POST 
> ['NameFirst'],'NameLast'=>$_POST['NameLast'],
> 'Company_Name'=>$_POST['Company_Name'],
> 'Language_you_translate_from[]'=>$_POST 
> ['Language_you_translate_from'],

Oops, there it was.
Language_you_translate_from[] is a notation to get the multiple  
selected values formatted into an array (well the brackets at the end  
are!)
The field name in Filemaker should not be altered. I assume it is  
Language_you_translate_from ?

Instead, put this in:
'Language_you_translate_from' => implode("\n", $_POST 
['Language_you_translate_from']),

> 'Language_you_translate_into'=>$_POST['Language_you_translate_into'],
> );
> foreach($add_result_fields as $key=>$value) {

Also, change this:

>   $add_result_add->AddDBParam('Language_you_translate_from',
> implode( "\n", $Language_you_translate_from ));

Into this:

   $add_result_add -> AddDBParam($key, $value);

> }
// snip

I think this should do it...

Let us know how you get along...

/Erik

> On May 2, 2007, at 12:33 AM, Gjermund Gusland Thorsen wrote:
>
>> change name of variable to: Language_you_translate_from[]
>>
>> add_result_add->AddDBParam( 'whateverFieldYouWouldLikeToFill',
>> implode( "\n", $Language_you_translate_from ) );
>>
>> ggt667
>>
>> On 5/2/07, Larry Schultz <larry at macedge.net> wrote:
>>> I'm trying to use a multi select value list.
>>> I do get the multi select list, and I AM able to select multiple
>>> items. The problem is I don't know how to pass them on to FM through
>>> the results page.
>>> Any help is appreciated.
>>>
>>> Add:
>>> <select multiple="true" name="Language_you_translate_from">
>>>         <?php
>>>                 foreach(fmsValueListItems
>>> ($PeritusFX,'NewTranslatorOnlineProfile_Web','LanguageSingle') as
>>> $list_item) {
>>>                          if($list_item == "") {
>>>                                 echo "<option value=\"{$list_item} 
>>> \" selected=\"selected\">
>>> {$list_item}</option>\n";
>>>                          } else {
>>>                                 echo "<option value=\"{$list_item} 
>>> \">{$list_item}</option>\n";
>>>                           }
>>>                         }
>>>         ?>
>>> </select>
>>>
>>>
>>> Post:
>>> <?php
>>> $add_result_add = clone($PeritusFX);
>>> $add_result_add->layout = 'NewTranslatorOnlineProfile_Web';
>>> $add_result_fields = array('Language_you_translate_from'=>$_POST
>>> ['Language_you_translate_from'],
>>> );
>>> foreach($add_result_fields as $key=>$value) {
>>>      $add_result_add->AddDBParam($key,$value);
>>> }
>>>
>>> $add_result_result = $add_result_add->FMNew();
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>
> Larry Schultz
>             Mac Edge Corporation
> Specializing in Filemaker Pro Relational Database Solutions
>                             for Mac/Windows/NT
>
> FBA Member
>
>
> larry at macedge.net
> larryschultz1 at mac.com
> 408-996-0831
> 510-502-4365
>
>           -------------Take A Deep Breath-------------
>
>  "I quickly discovered that Apple, Inc., isn’t just a company.   
> It’s the world’s only publicly traded religion. "
> Brett Arends, Boston Herald Finance Columnist  December 2005
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



---
Erik Andreas Cayré
Spangsbjerg Møllevej 169
6705 Esbjerg Ø

Privat Tel: 75150512
Mobil: 40161183

---
»Interesse kan skabe læring på en skala sammenlignet med frygt, som  
en nuklear eksplosion i forhold til en kineser.«
--Stanley Kubrick

»Kun p....sure mennesker kan ændre verden. Innovation skabes ikke af  
'markedsanalyse', men af folk, der er afsindigt irriterede over  
tingenes tilstand «
--Tom Peters

»Hvis du ikke kan forklare det simpelt, forstår  du det ikke godt nok.«
-- Albert Einstein

»Hvis du ikke har tid til at gøre det rigtigt, hvornår vil du så have  
tid til at lave det om?«
-- John Wooden, basketball coach




More information about the FX.php_List mailing list