Jump to content

POST variable and page refresh issue


jasonlive
Go to solution Solved by brianlange,

Recommended Posts

hey all,

 

i am a bit lost on this one.

i have a single php page

 

it has a login form

a submit new timesheet form

and a display my timesheets table. this is updated as soon as the user submits a new timesheet.

 

my issue is, after a timesheet has been submitted once, the table will add a row from the database and its great. but if i page refresh, it submits another identical timesheet. this happens even if i unset all the post variables.

 

what is the best resolution. is there some kind of cookie i have to use? i'd rather avoid cookies. i'd also rather avoid having a second php file.

 

i dont fully understand the $_POST variable concept. why are they not unset?

 

Edited by jasonlive
Link to comment
Share on other sites

 


Or if you have unique values being inserted you could do a select statement before you do the insert.

 

Uniqueness cannot be guaranteed that way, it can only be done by a unique constraint in the database.

But in this case there is nothing that has to be unique, it's even possible that the new data must overwrite existing data.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.