Re: [PHP] Refresh (F5) adds another SQL record.

2008-12-08 Thread Bhupendra Patel
If the user hits the back button and then the forward, it sometimes resubmits the form. This is why i initiated the session and ended it at the end of the data processing page. If they happen to press forward, or back, it will still not initiate the form unless they have actually visitied and

Re: [PHP] Refresh (F5) adds another SQL record.

2008-12-07 Thread Bhupendra Patel
I've found a way that works for me. Using the START SESSION on the initial form, e.g. ?php session_start(); // store session data $_SESSION['form'] = 1; ? and the using the code below in the processing form. You can do a check if the user has already submitted the from by the initial

Re: [PHP] Refresh (F5) adds another SQL record.

2008-12-07 Thread Ashley Sheridan
On Sun, 2008-12-07 at 16:44 +, Bhupendra Patel wrote: I've found a way that works for me. Using the START SESSION on the initial form, e.g. ?php session_start(); // store session data $_SESSION['form'] = 1; ? and the using the code below in the processing form. You can do a

Re: [PHP] Refresh (F5) adds another SQL record.

2005-05-19 Thread Satyam
Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Robert Meyer wrote: Hello, Scenario: 1) User is presented a blank form. 2) User fills in form. 3) User submits form. 4) Record is added to database. 5) Back to 1). Go really back to 1) - use redirect. After the

Re: [PHP] Refresh (F5) adds another SQL record.

2005-05-19 Thread Satyam
Aren't we oversimplifying the issue assuming that the records inserted cannot have everything duplicated but the autoincrement field? If you are taking an order and the customer says 'hey, add another of this', with the code below the system will reject it because it assumes that it is a

Re: [PHP] Refresh (F5) adds another SQL record.

2005-05-19 Thread Satyam
I did something pretty similar to this but not with an MD5 hash. I used a table which had just two fields, one autoincrement and another one a boolean. When doing a form, I added one record to this table and the ID I got from it is the one I sent in the form, the other field served to

Re: [PHP] Refresh (F5) adds another SQL record.

2005-05-18 Thread Richard Lynch
On Tue, May 17, 2005 2:24 pm, Robert Meyer said: Hello, Scenario: 1) User is presented a blank form. with an MD5 hash which is stored in the database as fresh 2) User fills in form. 3) User submits form. 4) Record is added to database. That particular MD5 has is marked as used 5) Back

Re: [PHP] Refresh (F5) adds another SQL record.

2005-05-18 Thread Mukasa Assey Alfred
Force a reload of the document after step (4), you may use javascript to reload this document, ie... After step (4) add this line... print scriptdocument.location.href='your-document-url';/script; Assey. On Tue, 17 May 2005, Robert Meyer wrote: Hello, Scenario: 1) User is presented a blank

Re: [PHP] Refresh (F5) adds another SQL record.

2005-05-18 Thread Mukasa Assey Alfred
On Tue, 17 May 2005, Robert Meyer wrote: As a last resort, I may have to do that, but that is by no means the preferred method. I want to keep database access to a minimum. I thought by this time this problem would have had a standard solution. It would be nice if PHP had a function like

Re: [PHP] Refresh (F5) adds another SQL record.

2005-05-18 Thread M. Sokolewicz
Next time, Mukasa, try reading... Robert clearly states that he'd like a PHP function which TELLS him if the page has been refreshed or not (thus, resent). There are headers sent out that indicate this, and thus a function like refreshed() would be a shortcut to getting to know if it has. He

Re: [PHP] Refresh (F5) adds another SQL record.

2005-05-18 Thread Marek Kilimajer
Robert Meyer wrote: Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Robert Meyer wrote: Hello, Scenario: 1) User is presented a blank form. 2) User fills in form. 3) User submits form. 4) Record is added to database. 5) Back to 1). Go really back to 1) - use redirect.

Re: [PHP] Refresh (F5) adds another SQL record.

2005-05-18 Thread Mukasa Assey Alfred
Sorry for that., i miss read that.. sorry, thought he wanted a php function to refresh the browser. Assey. On Wed, 18 May 2005, M. Sokolewicz wrote: Next time, Mukasa, try reading... Robert clearly states that he'd like a PHP function which TELLS him if the page has been refreshed or not

RE: [PHP] Refresh (F5) adds another SQL record.

2005-05-17 Thread Jay Blanchard
[snip] 6) User clicks refresh. 7) Another record is added, same data except auto-increment field. How do I prevent these last two steps, or at least prevent a record from being added when refresh is clicked? [/snip] Test for the existence (SELECT statement with the variables therein) of the

Re: [PHP] Refresh (F5) adds another SQL record.

2005-05-17 Thread Marek Kilimajer
Robert Meyer wrote: Hello, Scenario: 1) User is presented a blank form. 2) User fills in form. 3) User submits form. 4) Record is added to database. 5) Back to 1). Go really back to 1) - use redirect. After the record is added to the database, use something like: header('Location:

Re: [PHP] Refresh (F5) adds another SQL record.

2005-05-17 Thread Marcus Joyce
Why dont you check that data isnt being duplicated? $query = SELECT auto_col FROM table where col1 = $var1 col2 = $var 3.; $call_query = mysql_query($query,... $query_data = mysql_assoc($call_query); if(!$query_data) { do form } else echo information already exists in database;

Re: [PHP] Refresh (F5) adds another SQL record.

2005-05-17 Thread Robert Meyer
Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Robert Meyer wrote: Hello, Scenario: 1) User is presented a blank form. 2) User fills in form. 3) User submits form. 4) Record is added to database. 5) Back to 1). Go really back to 1) - use redirect. After the

Re: [PHP] Refresh (F5) adds another SQL record.

2005-05-17 Thread Robert Meyer
As a last resort, I may have to do that, but that is by no means the preferred method. I want to keep database access to a minimum. I thought by this time this problem would have had a standard solution. It would be nice if PHP had a function like refreshed() so one could do ... if