[FX.php List] Form Redux Basics

Jonathan Schwartz jonathan at exit445.com
Fri May 18 11:18:02 MDT 2007


Hi folks,

Just when you think that you know what you are doing, you find 
yourself back at square one.

I'm working on a "update your information" page.  The form containing 
basic input fields that are initially populated from Filemaker.  The 
submit button points php back to the same page ['PHP_SELF'], where 
the top half of the page/script deals with error checking.  If there 
are no errors, the page heads off to the next page.  If there are 
errors, the page redisplays the form plus the error message. The top 
half of the page containing error checking is only processed if the 
submit button has been clicked.

Here's the issue.  The first time the form is displayed, it displays 
data from the FMP query.  However, the second time it displays would 
be if an error was found. It should display the data that has been 
submitted in the form that has not yet been sent to FMP for updating 
the file.

Thus, the form needs to display data from two different states: 
Initial FMP query values or updated values entered in this session.

Here's what I did.  Upon the initial FMP query, I write the field 
values to $_SESSION variables.  The form displays the SESSION 
variables.  Also ,when the form is submitted and runs the error 
checking at the top of the page, I set the SESSION variables again 
from the $_POST.  Finally, the FMP query to update the file would be 
based on SESSION variables.

I suppose that I could use a different method that contains a php if 
statement at each field, determining which values gets displayed, FMP 
query or $_POST, but that seemed tedious.

Anyone else have the same experience?

Thx

Jonathan

-- 
Jonathan Schwartz
Exit 445 Group
jonathan at exit445.com
http://www.exit445.com
415-381-1852
FileMaker 8 Certified Developer


More information about the FX.php_List mailing list