[FX.php List] preventing refresh from rePOSTing?

Bob Patin bob at patin.com
Wed Jun 4 20:59:20 MDT 2008


Your solution is easy, although it means that the record is written on  
page A and then you go to page B... I use that method in a lot of  
situations.

However, you wouldn't have to do a find for ALL fields on the form-- 
just one flag field.

In your post, you'd send a variable that is a unique identifier, and  
which could be written to a field in the database. Using PHP, create a  
random number, write the record.

If someone were to refresh, the query would find that the variable  
already exists in a record, and skips the record-creation. It requires  
an additional query on the page though, and also requires an extra  
field in the database. Not really an elegant solution...

I haven't used it, just spinning out a possibility...

Bob Patin
Longterm Solutions
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com
FileMaker 9 Certified Developer
Member of FileMaker Business Alliance and FileMaker TechNet

   CONTACT US VIA INSTANT MESSAGING:
      AIM or iChat: longterm1954
      Yahoo: longterm_solutions
      MSN: tech at longtermsolutions.com
      ICQ: 159333060

--------------------------
Contact us for FileMaker hosting and programming for all versions of  
FileMaker
PHP • CDML • Full email services • Free DNS hosting • Colocation •  
Consulting


On Jun 4, 2008, at 5:30 PM, Joel Shapiro wrote:

> Thanks for the quick reply, Bob.
>
> I had thought of that, but it seemed like a lot to do (do a find for  
> all fields on the form)
>
> What I did was put:
> header('Location: mypage.php');
> exit;
>
> after a successful FMNew(), so now a refresh no longer contains POST  
> data
>
> Solved (& pretty painlessly :)
>
> -Joel
>
>
> On Jun 4, 2008, at 3:08 PM, Bob Patin wrote:
>
>> I don't know of a standard way, but you might write some code that  
>> does a duplicate check before writing the record; send some sort of  
>> unique identifier with your POST, and then a dupe record couldn't  
>> be created...
>>
>> Off the top of my rather bald head,
>>
>> Bob Patin
>> Longterm Solutions
>> bob at longtermsolutions.com
>> 615-333-6858
>> http://www.longtermsolutions.com
>> FileMaker 9 Certified Developer
>> Member of FileMaker Business Alliance and FileMaker TechNet
>>
>>  CONTACT US VIA INSTANT MESSAGING:
>>     AIM or iChat: longterm1954
>>     Yahoo: longterm_solutions
>>     MSN: tech at longtermsolutions.com
>>     ICQ: 159333060
>>
>> --------------------------
>> Contact us for FileMaker hosting and programming for all versions  
>> of FileMaker
>> PHP • CDML • Full email services • Free DNS hosting • Colocation •  
>> Consulting
>>
>>
>>
>>
>> On Jun 4, 2008, at 4:51 PM, Joel Shapiro wrote:
>>
>>> Hi all
>>>
>>> I've got a real small project in which a user fills out a web  
>>> form, and as long as all required fields contain data, a new  
>>> record gets created on submit.
>>>
>>> I've got the processing and the form on the same php page.
>>>
>>> Can anyone suggest a quick/easy way to prevent the user from  
>>> rePOSTing -- and thus adding an additional (duplicate) record --  
>>> by refreshing the page after submission?  The page *does* need to  
>>> allow a user to submit additional records after the first  
>>> submission, but I don't want a simple refresh to create a new  
>>> record.
>>>
>>> I can think of some ways to do this but don't want to re-invent  
>>> the wheel if there's some standard way to do this already.
>>>
>>> TIA,
>>> -Joel
>>> _______________________________________________
>>> 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



More information about the FX.php_List mailing list