You are here: Re: Back button « All PHP « IT news, forums, messages
Re: Back button

Posted by Tyno Gendo on 09/14/07 13:57

Albert Ahtenberg wrote:
> Hello,
>
> I have two questions.
>
> 1. When the user presses the back button and returns to a form he filled
> the form is reseted. How do I leave there the values he inserted?

I always capture the values into a session and when the form is created
I echo the session values into the value="" section, or whatever is
needed, different in the case of checkboxes etc., have to mark as
selected="selected" etc.

You could use normal cookies too if you don't want to start a server
session.

> 2. When the user comes back to a page where he had a submitted POST data
> the browser keeps telling that the data has expired and asks if repost. How
> to avoid that? I tried registering all POST and GET vars as SESSION vars but
> it also has its disadvantages...

I usually use a header redirect back to forms when data is invalid or
when a succesful submission is made, I use a session var 'messages' to
hold any messages to print at the top of the form

eg.

$_SESSION['messages'] = 'Your submission was invalid';
exit(header("Location: {$_SERVER['PHP_SELF'}"));

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация