[FX.php List] FX Repost
Steve Hannah
shannah at sfu.ca
Mon Apr 24 12:18:24 MDT 2006
Hi Gerry,
I haven't actually been using FX for a while so I don't recall the
exact syntax for some stuff.
But the general idea is:
Suppose you have PHP scripts:
1. RecordDetail.php - displays record details.
2. NewRecord.php - inserts new record.
In NewRecord.php you would have something like this:
---------
if ($form_has_been_submitted){
save_form_to_database();
$record_id = get_id_of_newly_inserted_record();
header('Location: RecordDetail.php?record_id='.$record_id);
exit;
}
display_form();
-----------
Comments on above snippet:
The $record_id is just some unique identifier for the record.
Generally you will have a field (or group of fields) that can
uniquely identify a record. This is just used to pass to the
RecordDetail.php script so that it knows which record it should display.
and in RecordDetail.php you would have something like:
$record_id = $_GET['record_id'];
display_record_with_id($record_id);
Note that all functions used in this example are fake - they are just
pseudo-code to give the idea of what to do and when.
Hope this helps
-Steve
On 24-Apr-06, at 11:07 AM, gerry.charest at agfa.com wrote:
> Thanks for the reply Steve,
>
> My inquiry was more in-line with the creation of new records.
> Navigational speaking I thing I understand is this an accurate
> representation?
>
> 1. New Form page
> 2. Scripts page enters data Redirects user to results page
> 3. Results page displays Posting
>
> Assuming this is correct how do you return to the record just posted?
>
> Gerry Charest
> Agfa Corporation
>
> <graycol.gif>
> Steve Hannah <shannah at sfu.ca>
>
>
> <ecblank.gif>
>
> <ecblank.gif>
>
> Steve Hannah <shannah at sfu.ca>
> Sent by: fx.php_list-bounces at mail.iviking.org
> 04/24/2006 01:56 PM
> Please respond to "FX.php Discussion List"
>
> <ecblank.gif>
>
>
> To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> cc: (bcc: Gerry Charest/MJVYN/AGFA)
> Subject: Re: [FX.php List] FX Repost
>
>
> In general it is good practice to only use POST requests when records
> will be modified by the request. Otherwise GET requests should be
> used. To avoid the case where a POST request is used to return a
> result set, I will generally always use GET requests to display
> information, and have scripts that use POST to modify information
> simply forward (i.e. header('Location: /path/to/results.php') ) to
> the GET request to show the results. With this approach, repost
> becomes a non-issue.
>
> Best regards
>
> Steve Hannah
> On 24-Apr-06, at 10:45 AM, gerry.charest at agfa.com wrote:
>
> > I'm in the process of designing a site with PHP, FX and FMP. I
> > recall in the days of CDML you could have repost issues (duplicate
> > records) when a user pressed the back or refresh button. Are there
> > similar issues with PHP and FX? Is there a standardized method to
> > avoid repost if the user refreshes page that would create a record?
> >
> > Gerry Charest
> > Agfa Corporation
> >
> > _______________________________________________
> > FX.php_List mailing list
> > FX.php_List at mail.iviking.org
> > http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
>
> ----------------------------------------
> Steve Hannah
> Web Services Developer
>
> Faculty of Applied Sciences
> Simon Fraser University
> shannah at sfu.ca
> 604-268-7228
> Homepage: http://www.sjhannah.com
>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
> <graycol.gif>
> <ecblank.gif>
> <pic12493.gif>
> _______________________________________________
>
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20060424/b0613954/attachment.html
More information about the FX.php_List
mailing list