how can i unset $_POST array

A

Anonymous

Guest
hi friends,
i have a page contains a form.
this form s action is the page.
so i control $_POST["submit_button_name"] as this.

if ($_POST["submit_button_name"])
{
// process form values
}
else
{
// show form elements
}
.

if a user enters some values to the form elements and press submit button it process the values and write it to db.
and after this if the user press refresh button of the browser it agains process the form values and same values will be written to the db.
so i want to unset $_POST array after first processing of the form values.
how can i unset $_POST arrays values, so after refreshing the code sense that submit button did not pressed.
i think i solve this problem as this.
do you help me about this and do you have another idea different to solve this problem.
thanks for your help.
 
Hi,

I don't know if writing unset($_POST['submit']) at the end of the if($_POST['submit']) would work, might be worth a check... anyway, you can redirect to another page as nyy2000 has said or you can also prevent the insertion of duplicate values by previously checking their existence in the db.

Regards.
 
Back
Top