[FX.php List] carry data over
Jonathan Schwartz
jonathan at eschwartz.com
Wed Sep 6 10:34:09 MDT 2006
Dale,
Thanks for the detail.
I, too, have been putting the calc field for recid on the layout and
using it in subsequent searches after the first page. I thought that
I was "cheating" a little, because it's so easy to just continue
using the same field after FM returns the value....versus using some
other key value. ;-)
Thanks for the validation.
>Jonathan,
>
>I was addressing the fact that it's not necessary to hit your FMP
>table with a FMFind() immediately after performing FMNew() ... or
>FMEdit() for that matter ... to obtain the record data.
>
>In the scenario presented by the original poster, the second input
>form is presented to the user as the "landing" page from the first
>form submit, which would require no additional FMFind(). If it's
>possible for your users to move around non-linearly, then yes,
>absolutely, you would need to keep track of the record id or a
>primary key to retrieve the record again.
>
>As for retrieving the record id, I prefer to just parse it out of
>the FX array since it's already there, rather than create a
>redundant calc field that exposes it in the field data. Whenever
>possible, I let PHP do the work instead of FMP. It's faster that way.
>
>Dale
>
>
>
>On Sep 6, 2006, at 10:24 AM, Jonathan Schwartz wrote:
>
>>Chiming in...
>>
>>That is the case when the second page containing the FMNew response
>>also contained the second form...or at least performed an include
>>for the second form. Otherwise, we'd be looking into setting
>>variables in sessions to track the recid. Correct?
>>
>>I'm making this distinction because many of the examples and
>>tutorials out there offer a simple form->form response scenario,
>>and don't address the reality of a continuous process which can
>>involve multiple forms in the process as well as multiple functions
>>on the same page.
>>
>>Gary...this was a major stumbling block in my own learning curve of
>>how to track the same record throughout a series of pages. Once I
>>learned how to use "sessions", it was smooth sailing. I encourage
>>you to get this under your belt as soon as you can.
>>
>>Jonathan
>>
>>>Actually, you don't need to re-find the record you just created.
>>>The variable you set to be the result of FMNEW() contains the
>>>typical FX data array for a single FMP record, including the
>>>record ID. You can reference this in the second form.
>>>
>>>Dale
>>>
>>>On Sep 6, 2006, at 7:13 AM, Alex Gates wrote:
>>>
>>>>Gary,
>>>>
>>>>You'll need the recid of the page you want to edit -
>>>>On your FileMaker layout, create a calculation field that is
>>>>Get(RecordID) http://www.filemaker.com/help/FunctionsRef-251.html
>>>>
>>>>Before you move to the second page, you'll first need to find the record
>>>>you just created. Bring back the record ID, make it a session variable,
>>>>and use it on the following pages as the parameter in your edit.
>>>>
>>>>Your edit will look something like this:
>>>>
>>>>$edit=new FX($serverIP,$webCompanionPort,'FMPro7');
>>>> $edit->SetDBData('FileName.fp7','LayoutName');
>>>> $edit->SetDBPassword('password','username');
>>>> $edit->AddDBParam('-recid', $recid);
>>>> $edit->AddDBParam('AdditionalField1', $additionalfield1);
>>>> $edit->AddDBParam('AdditionalField2', $additionalfield2);
>>>>//(and so on)
>>>> $editResult=$edit->FMEdit();
>>>>
>>>>
>>>>The Ultimate Guide to FileMaker and PHP is a really great resource -
>>>>page 152 walks you through a wonderful example.
>>>>
>>>>http://www.fmwebschool.com/filemaker_php.php
>>>>
>>>>I hope this helps - - I didn't go step by step through everything, but
>>>>the Ultimate Guide does - - I've used it a lot and I find it very
>>>>helpful.
>>>>
>>>>If anyone has anything to add that I have forgotten, please do so.
>>>>I'm still trying to get my feet wet with this stuff, but I like to try
>>>>to help whenever I can...
>>>>
>>>>Alex P. Gates
>>>>-----Original Message-----
>>>>From: fx.php_list-bounces at mail.iviking.org
>>>>[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Gary Redmond
>>>>Sent: Wednesday, September 06, 2006 3:19 AM
>>>>To: FX.php Discussion List
>>>>Subject: [FX.php List] carry data over
>>>>
>>>>Ok I have a form that asks a user for their name etc, when they press
>>>>submit it adds the details to a new record however, I would like to have
>>>>
>>>>another form on the next page that allows them to add more to the
>>>>record.
>>>>
>>>>
>>>>_______________________________________________
>>>>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
>>>
>>>_______________________________________________
>>>FX.php_List mailing list
>>>FX.php_List at mail.iviking.org
>>>http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
>>--
>>
>>Jonathan Schwartz
>>FileMaker 8 Certified Developer
>>Associate Member, FileMaker Solutions Alliance
>>Schwartz & Company
>>jonathan at eschwartz.com
>>http://www.eschwartz.com
>>http://www.exit445.com
>>415-381-1852
>>
>>_______________________________________________
>>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
--
Jonathan Schwartz
FileMaker 8 Certified Developer
Associate Member, FileMaker Solutions Alliance
Schwartz & Company
jonathan at eschwartz.com
http://www.eschwartz.com
http://www.exit445.com
415-381-1852
More information about the FX.php_List
mailing list