[FX.php List] Creating new portal record via form

Marisa Smith marisa at datasmithconsulting.net
Fri Aug 19 09:27:50 MDT 2005


Chris - thank you for your explanation of this.  I hope to have time to try
this next week.  I have a workaround in place for now that avoids using a
portal by entering data through a second query that creates new records in
the related table.

Marisa

On 08/17/2005 12:45 PM, "Chris Hansen" <chris at iViking.org> wrote:

> Marisa,
> 
> Yes, PHP will replace periods with underscores as they come in via a
> form.  At least, I'm pretty sure it's PHP.  There are a number of ways
> that you could handle this:
> 
> 1) Add a PHP array to the top of your processing page that sets up a
> one-to-one correlation between the names of form fields and database
> fields.  This would also allow you to hide information about your DB
> from people who view the pages' source.  Not a bad idea.  This would
> look something like this:
> 
> $translationArray = new array('field1_0' => 'FM_Field_1.0', 'field2_0'
> => 'FM_Field_2.0');
> 
> 2) Use a specific pattern which wouldn't normally appear in a field
> name any place that you want a '.' to appear on the FileMaker side,
> then do a replace (I'm using three underscores in a row, in my
> example):
> 
> $mod_main->AddDBParam(str_replace('___', '.', $key), $value);
> 
> There are other ways that you could handle this, too.  That said,
> whatever you do, I'd suggest changing the names of the fields on the
> form side.  Although PHP does appear to change '.' to '_' very
> consistently in form element names, it's generally unwise to base code
> on this sort of behavior.  By changing the field names, you ensure that
> you're in control of what is sent.
> 
> HTH
> 
> --Chris Hansen
>    creator of FX.php
>    "The best way from FileMaker to the Web."
>    www.iViking.org
> 
> On Aug 12, 2005, at 3:36 AM, Marisa Smith wrote:
> 
>> I'm trying to add data to a portal using a form.  In order to do this,
>> I
>> have put a form field on my page:
>> 
>> <input type="text" name="pledge_designations::agencyid.0" value="">
>> 
>> When I look at the URL passed in the request, a "_0" has been
>> substituted
>> for the ".0" before the portal row number, which makes the request
>> invalid:
>> 
>> http://username:password@192.168.0.3:80/fmi/xml/FMPXMLRESULT.xml?-
>> db=unitedw
>> ay.fp7&-lay=pledges&-max=50&action=edit&screen=3&-
>> recid=&plat=pledges&pledge
>> _designations::agencyid_0=3&-edit
>> 
>> Any idea why this is happening?
>> 
>> Here's the code I am using to perform the record edit:
>> 
>>     $mod_main = new FX($serverIP, $webCompanionPort, $dataServerType);
>>     $mod_main->FMUseCURL(false);
>>     $mod_main->SetDBData($_SESSION['db_filename'], $layout);
>>     $mod_main->SetDBPassword($password,$DBUser=$user);
>>     //loop through POST vars and add them to the edit query
>> 
>>     foreach ($_POST as $key => $value)
>>         {
>> 
>>         $mod_main->AddDBParam($key,$value);
>>         }
>>          $a_result=$mod_main->FMEdit();
>> 
>> 
>> I have tried printing out the $_POST variables before they are
>> submitted and
>> the substitution appears to happen before they hit FX, but I cannot
>> find
>> anything on Google to help me figure out why this is happening.
>> 
>> I am using FMSA7v3 and PhP 4.3.6 on OS 10.3
>> 
>> ---------------------------------------------------------------------
>> Marisa Smith, President
>> DataSmith Consulting, LLC
>> 9206 Huron River Drive
>> Dexter, MI 48130
>> Phone & Fax: (734) 426-8077
>> Cell: (734) 834-2638
>> http://www.datasmithconsulting.net
>> Filemaker Solutions Alliance Associate Member
>> 
>> 
>> _______________________________________________
>> 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
> 
> 

---------------------------------------------------------------------
Marisa Smith, President
DataSmith Consulting, LLC
9206 Huron River Drive
Dexter, MI 48130
Phone & Fax: (734) 426-8077
Cell: (734) 834-2638
http://www.datasmithconsulting.net
Filemaker Solutions Alliance Associate Member




More information about the FX.php_List mailing list