|
Posted by Juliette on 07/18/06 02:22
s a n j a y wrote:
> mindwarp wrote:
>> Hi,
>>
>> When a user submits / posts data my php script Inserts data into my
>> database.
>> If they refresh the script or click back and click submit again I get
>> duplicate record.
>>
>> Is there an easy solution to this?
>>
>> Or do I need to create a hidden field which contains some sort of
>> unquie data, like a time stamp and have a have a unique field which
>> stops it adding the record?
>>
>> Best regards,
>>
>> Jules.
>>
>
> I would go with what Jerry said. Set a session variable indicating that
> insertion has been done. If user tries to repost, check for existence of
> the variable and just escape all the insertion code.
I wouldn't advice that as that would also exclude a user from posting
*something else* using the same form.
Navigation:
[Reply to this message]
|