[FX.php List] Problem with creating duplicate records

Bob Patin bob at patin.com
Fri Jul 21 16:46:55 MDT 2006


Jerry,

Here's one way to do it:

in your form, add a hidden field, call it "valid". Set its value to 1.

In formA_response.php, put this at the top of the page somewhere

if($_POST['valid']==1){

<<here's where the rest of the PHP code would go>>

After the record is created, add this line:

$_POST['valid']="";

}



I haven't tested that last line, but I *think* that would work;  
someone will certainly correct me if I'm wrong!




On Jul 21, 2006, at 4:45 PM, Jerry Do wrote:

> Hello all,
>
> I am new to fx.php and php.  I have problem users create duplicate  
> records
> by reload the response page.
> For example:
> I have a form name "formA" and the ACTION ="formA_response.php".
> When the user click submit, the form will send all the information to
> formA_response.php.
> The formA_response.php page is the page to create new record.  I  
> noticed
> that if a user reload formA_reload.php,  new record will be  
> created.  Is
> there a good method to prevent the user reload the page or going to  
> that
> page?
> I am thinking that I might send to a page that will create the  
> record then
> close that page after the record created.  However, I am not sure  
> it will
> work or how to do write it yet.
>
> Any input is welcome.
>
> Thank you in advance,
>
> _______________________________________________
> 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