- Upgrading from v1.x
- Finalized Submissions
- Debugging Mode
- API Error Codes
- API Sessions
- Feature Suggestions
This invaluable little function is a wrapper for ft_load_field, used in the core script. It's used for storing and overwriting the contents of a single form field in sessions based on a sequence of priorities.
It assumes that a variable name can be found in GET, POST or SESSIONS (or all three). What this function does is return the value stored in the most important variable (GET first, POST second, SESSIONS third), and update sessions at the same time. This is extremely helpful in situations where you don't want to keep having to submit the same information from page to page. The third parameter is included as a way to set a default value.
It takes three parameters:
- the field name
- the session key used to store the value
- the default value
One common place for this is to store the current page in memory for a paginated list of data:
This does the following: the first time the page is loaded, it uses the third parameter - the default value "1" (page 1). If the query string contains a page=X value or if the page has received a field called "page", it overwrites the value in sessions and stores the appropriate value in $page. The nice thing is that you don't need to keep sending the "page" value to the webpage. It will always remember the last value. This can save you a lot of fuss and bother!