create a back button. Would user info still be there?

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

pugs421
New php-forum User
New php-forum User
Posts: 31
Joined: Sat Jun 28, 2003 9:09 pm

create a back button. Would user info still be there?

Postby pugs421 » Sun Jul 13, 2003 12:20 pm

I know there are ways to resubmit the user info but I'm a novice and I can only do so much. As of now my form vaildation will display ex. "You must fill in your address" on a seperate page. If I somehow make a back button on that page using php will the info the user filled into the form stay there? Does it depend on the browser?

liquedus
php-forum Active User
php-forum Active User
Posts: 266
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada
Contact:

Postby liquedus » Sun Jul 13, 2003 12:38 pm

im pretty sure that, unless you clear the boxes with page load, that hitting the history.go(-1) in javascript will keep the values there, and i also think that hitting the back button works to the same effect.

pugs421
New php-forum User
New php-forum User
Posts: 31
Joined: Sat Jun 28, 2003 9:09 pm

Postby pugs421 » Sun Jul 13, 2003 12:50 pm

oh. I can just do it with javascript huh? I know they could hit the back button but I figured it would be more user friendly to provide one. I'll give that a try. thanks.

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Sun Jul 13, 2003 6:48 pm

This is the second time I've answered this question today. The usual method is to make the form submit to itself (i.e. <form action="<?= $_SERVER['PHP_SELF'] ?>" ...>). Then on the page with the form, check to see if the form has been submitted. If it has, do your validation, and if anything is missing, display the form again with all the submitted information filled in (i.e. <input type="text" name="username" value="<?= $_REQUEST['username'] ?>">) and highlight the fields that the user missed. For the record, form validation is a pain in the arse. I recommend reading one of the dozens of good form validation tutorials that Google will find for you and/or don't reinvent the wheel and just download someone else's script.


Return to “PHP coding => General”

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

cron