retaining form information when someone presses back
retaining form information when someone presses back
am 01.01.2007 09:13:37 von Flint Million
This might not be relavent for this forum, so if not please direct me
to the proper one; although I do like to keep my email list
subscriptions down.
I have a custom application in PHP in which a user fills out a form of
information. When the user submits, I perform sanity checking on the
user's submitted data and refuse to actually process/insert it if
those checks fail. However, my users are complaining that when they
press back to correct, all the data is gone from the form and they
have to re-enter it all. I know many websites that can retain the form
data when someone presses back; how is this done?
Flint M
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: retaining form information when someone presses back
am 01.01.2007 18:37:00 von Bastien Koert
i tend to have a function that show the form and a processing function. In
the processing function i preform my sanity checks and then if there are
errors pass the $_POST data back to the show_form($data, $errors) with the
relevant errors. This removes the need to have the users press the back
button and allows the form to show its data again..
Bastien
>From: "Flint Million"
>To: php-db@lists.php.net
>Subject: [PHP-DB] retaining form information when someone presses back
>Date: Mon, 1 Jan 2007 02:13:37 -0600
>
>This might not be relavent for this forum, so if not please direct me
>to the proper one; although I do like to keep my email list
>subscriptions down.
>
>I have a custom application in PHP in which a user fills out a form of
>information. When the user submits, I perform sanity checking on the
>user's submitted data and refuse to actually process/insert it if
>those checks fail. However, my users are complaining that when they
>press back to correct, all the data is gone from the form and they
>have to re-enter it all. I know many websites that can retain the form
>data when someone presses back; how is this done?
>
>Flint M
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
____________________________________________________________ _____
Enter the "Telus Mobility Xbox a Day" contest for your chance to WIN! Telus
Mobility is giving away an Microsoft Xbox® 360 every day from November 20 to
December 31, 2006! Just download Windows Live (MSN) Messenger to your
IM-capable TELUS mobile phone, and you could be a winner!
http://www.telusmobility.com/msnxbox/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: retaining form information when someone presses back
am 01.01.2007 18:55:33 von Chris
Flint Million:
> This might not be relavent for this forum, so if not please direct me
> to the proper one; although I do like to keep my email list
> subscriptions down.
>
> I have a custom application in PHP in which a user fills out a form of
> information. When the user submits, I perform sanity checking on the
> user's submitted data and refuse to actually process/insert it if
> those checks fail. However, my users are complaining that when they
> press back to correct, all the data is gone from the form and they
> have to re-enter it all. I know many websites that can retain the form
> data when someone presses back; how is this done?
>
> Flint M
>
ok, an input field might be something like
name='username' size='8' maxlegth='32'> --> the submitted variable would
be stored in $_POST["username"] (or $_GET["username"] depending on what
method you use to submit it)
your back-button should now contain a link like
href='fill-in-form.php?username=$_POST["username"]'>back to keep the
information
an other possibility might be using cookies but this would be impossible
if the user refuses to accept cookies, so this method might not be wanted
Chris
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: retaining form information when someone presses back
i'm not sure that will work, try playing with header cache-control. anyway
as Bastien metioned it is better to have your form redisplayed with values
the user entered when validation failed rather than asking the user to click
the back button of their browser.
try this sample (not tested, too lazy :) but should work):
$var1 = NULL;
$var2 = NULL;
if (isset($_POST)) {
$var1 = $_POST['var1'];
$var2 = $_POST['var2'];
}
echo '';
?>
On 1/1/07, Flint Million wrote:
>
> This might not be relavent for this forum, so if not please direct me
> to the proper one; although I do like to keep my email list
> subscriptions down.
>
> I have a custom application in PHP in which a user fills out a form of
> information. When the user submits, I perform sanity checking on the
> user's submitted data and refuse to actually process/insert it if
> those checks fail. However, my users are complaining that when they
> press back to correct, all the data is gone from the form and they
> have to re-enter it all. I know many websites that can retain the form
> data when someone presses back; how is this done?
>
> Flint M
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
GMail Rocks!!!
------=_Part_108262_5904035.1167721059936--
Re: retaining form information when someone presses back
am 04.01.2007 02:59:40 von Chris
Christopher Blöcker wrote:
> Flint Million:
>> This might not be relavent for this forum, so if not please direct me
>> to the proper one; although I do like to keep my email list
>> subscriptions down.
>>
>> I have a custom application in PHP in which a user fills out a form of
>> information. When the user submits, I perform sanity checking on the
>> user's submitted data and refuse to actually process/insert it if
>> those checks fail. However, my users are complaining that when they
>> press back to correct, all the data is gone from the form and they
>> have to re-enter it all. I know many websites that can retain the form
>> data when someone presses back; how is this done?
>>
>> Flint M
>>
>
> ok, an input field might be something like
> name='username' size='8' maxlegth='32'> --> the submitted variable would
> be stored in $_POST["username"] (or $_GET["username"] depending on what
> method you use to submit it)
Please no!
*At least* use htmlentities or htmlspecialchars to stop xss attacks.
If I put:
as my username, and that alerts 'x', then I can steal cookies from your
computer and other bits of info as well.