Get support from Xavier Media
It is currently Sun Dec 08, 2013 12:25 pm

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Page not showing up in the back button history.
PostPosted: Wed Sep 13, 2006 6:13 pm 

Points:
Hey,

Has anyone ever had a problem with a page not being added to the back button history?

Here is my problem and page flow:

Page 1: User enters information in a form and submits it.

Page 2: INSERTS the information into the database and redirects to...

Page 3: Displays a printable view of the submitted info.

I need this process to be as fool-proof as possible so I am trying to guard against an accidental duplicate INSERT via page refresh or something.

The problem is -if the user happens to click the back button from Page 3, it goes directly to Page 1. This is bad because they could re-submit the same information again.

I had a catch for Page2 if the user re-entered it, but -since it's not in the back history - it won't stop the user.

Any clue why Page2 would be missed by the back button?

Its strictly a .php INSERT script and generates no HTML at all.

Thanks!


Report this post
Top
  
Reply with quote  
 Post subject: hmm...
PostPosted: Wed Sep 13, 2006 9:00 pm 

Points:
I am pretty sure that IE and Firefox ignore re-directs...

Can you be a little more specific about what type of re-direct? :wink:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: Wed Sep 13, 2006 9:14 pm 

Points:
Yeah, I just use:

[php]

echo "<meta http-equiv=Refresh content=2;url=page3.php>";

[/php]

But see, I get to Page 2 through a form submission, not a redirect.

That's why I'm a bit puzzled by this...

Or maybe I just don't fully understand it - probably that. :lol:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: Thu Sep 14, 2006 12:16 am 

Points:
WarpNacelle wrote:
But see, I get to Page 2 through a form submission, not a redirect.

That's why I'm a bit puzzled by this...

I know, but all that page two is, is a redirect.... so the browser just skips it and goes back to page one....

After all, even if you could go to page two you would just be sent on to page three.... :wink:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: Thu Sep 14, 2006 12:26 am 

Points:
So I better make sure it renders some type of HTML to officially make it a "page" right?


Report this post
Top
  
Reply with quote  
 Post subject: browser history
PostPosted: Thu Sep 14, 2006 1:00 am 

Points:
WarpNacelle wrote:
So I better make sure it renders some type of HTML to officially make it a "page" right?


I don't know...
Code:
<meta http-equiv=Refresh content=2;url=page3.php>

Is HTML... So I am at a loss as to the best way to handle this.
I think that you are going to need to handle all of this through your PHP code and not rely on a users history.

Actually, why do you have a "page 2" if it doesn't do anything but redirect. I think that the proper way to handle this is to combine page 2 and 3.

This is all I could find on Google, (not the best at answers) but it probably won't help...
http://www.thesitewizard.com/archive/phptutorial2.shtml
http://shiflett.org/articles/guru-speak-nov2004


Report this post
Top
  
Reply with quote  
 Post subject: Re: browser history
PostPosted: Thu Sep 14, 2006 3:04 am 

Points:
David wrote:

Actually, why do you have a "page 2" if it doesn't do anything but redirect. I think that the proper way to handle this is to combine page 2 and 3.

This is all I could find on Google, (not the best at answers) but it probably won't help...
http://www.thesitewizard.com/archive/phptutorial2.shtml
http://shiflett.org/articles/guru-speak-nov2004


Page 2 is an INSERT command into the database.

I had Page2 & 3 combined initially, but then I realized that an accidental refresh would cause a duplicate insert so that's when I split it up.

However, since I've been trying to work this out I may have be able to fix this going back to having 2 & 3 as one page.

Thanks for the links and advice.


Report this post
Top
  
Reply with quote  
 Post subject: cookie for browser history
PostPosted: Thu Sep 14, 2006 6:20 pm 

Points:
I was thinking about how to handle this last night and it dawned on me that you could use a cookie (less secure) or a session (harder) to store whether the user had completed the form. You could also put the information they entered into the cookie or session so that the form could be auto-filled with their data. For example,

Page 1:
[php]<?php
if ( (!isset($_COOKIE['form_submited'])) || ($_COOKIE['form_submited'] != "yes")) {

//Show the form


} else {

// (1 )send them on to page three because they have already filled it out. The cookie says so!
header("Location: http://www.example.com/page3.php");

// (2) or you could just show the form again and populate it with the data they entered:

echo "Name: ". $_COOKIE['name'];
//etc?.

}
?>[/php]

Page 2:

After the data is put into the database create the cookie and put the value "yes" (the form has been sent)
[php]<?php
$result = mysql_query($sql);
if (!$result) { // if the data was not inserted
$value = "no";
} else { // the query was fine so lets set the value to "yes"
$value = "yes";
}
setcookie("form_submited", $value, time()+3600); /* expire in 1 hour */

header("Location: http://www.example.com/page3.php");

?>[/php]

Again you could also set a whole bunch of cookies for all of the data fields that were on your form so that if the user went back (say there was a DB error) the form would be auto filled in.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: Sun Sep 17, 2006 7:39 pm 

Points:
Thanks!

I had acutally come to a similar conclusion - though not quite as detailed as yours! :)

I was thinking of using a SESSION variable that got set once the INSERT took place and, if the user did happen to hit the back button, would just send them back to the home page.

Yours does cover more bases though.

Thanks for taking time - I'll will definatley put it to use!


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Registered users: No registered users


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Portal » Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
[
SEO MOD © 2007 StarTrekGuide ]