Welcome to Dream.In.Code
Become an Expert!

Join 149,615 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,855 people online right now. Registration is fast and FREE... Join Now!




php method for back to previous page

 
Reply to this topicStart new topic

php method for back to previous page

greatday
1 Sep, 2007 - 06:06 AM
Post #1

New D.I.C Head
*

Joined: 1 Sep, 2007
Posts: 1


My Contributions
I have a form that checks for required fields and kicks error when fields are not complete. My error message says something like "You must enter name - Click Here to Return"
My code now takes us back to the form but does not retain what was already entered into the other fields, since my code, simply and only restarts the form.
CODE
print "\n<P><I>- <A HREF=\"http://www.abcdef.com/cgi-bin/abcdef.cgi\" TARGET=\"_top\">Return to Signing Page</A>\n";

How can I get to the previous page without loosing entrys on page?
User is offlineProfile CardPM
+Quote Post

guahguahmonster
RE: Php Method For Back To Previous Page
1 Sep, 2007 - 11:22 AM
Post #2

New D.I.C Head
*

Joined: 29 Aug, 2007
Posts: 39



Thanked: 1 times
My Contributions
It looks like the error page is on a separate page from the form input page? So that when the form is submitted and the fields are not complete, it displays that error page, with a link back to the form input page, right? If I am correct, I can think of three ways to fix your problem...

1) Have the values that were already submitted by the user be put on the "Error page" as hidden input fields, then when the user clicks the link, it gets submitted back to the page with the form, and then they are filled in.

2) Have the link trigger javascript's "history.go(-1)". Some browsers remember values that were already filled in on a form when the back button is pressed.

3) When an error occurs, instead of displaying a separate page with an error on it, display the same form (once again, you'll have to have your code process the stuff in POST and re-fill the form), but have an error on the top of the form.

Does that make sense?

BTW... CGI isn't the same as PHP is it...?

This post has been edited by guahguahmonster: 1 Sep, 2007 - 11:22 AM
User is offlineProfile CardPM
+Quote Post

snoj
RE: Php Method For Back To Previous Page
1 Sep, 2007 - 11:56 AM
Post #3

Fell off the face of the earth
Group Icon

Joined: 31 Mar, 2003
Posts: 3,325



Thanked: 9 times
Dream Kudos: 750
My Contributions
Moved.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 12:31AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month