Re: [PHP] Re: header( 'refresh' ), form data, and IE
- From: dkasak@xxxxxxxxxxxxxxxxxxxx (Daniel Kasak)
- Date: Wed, 25 Jul 2007 09:10:47 +1000
On Tue, 2007-07-24 at 08:13 -0400, Daniel Brown wrote:
Hello, Dans!
Dan K., is there any reason the validation can't reside within the
same script as the form, then forward on success? A very simple
example:
<?
if($_POST) {
// Check to ensure that your variables are all correct,
// then use header("Location: successful-target.php?var1=a&var2=b");
// And then, on forwarding, remember to exit;
}
?>
<FORM METHOD="POST" ACTION="<?=$_SERVER['PHP_SELF'];?>">
<INPUT TYPE="TEXT" NAME="var1" VALUE="<?=$_POST['var1'];?>"><BR />
<INPUT TYPE="TEXT" NAME="var2" VALUE="<?=$_POST['var2'];?>"><BR />
<INPUT TYPE="SUBMIT" VALUE="GO!">
</FORM>
Since the user will start with a blank form, and the $_POST values
won't already be set, the values in the form will be blank on the
initial page load, but for unsuccessful attempts, they'll be populated
with the correct data.
~ Dan^[3]
I've completely changed the way I was doing this now. Initially I
implemented lots of checks for NULL values, as Dan[2] recommended, and
this worked well apart from in the case of text areas. These broke
things completely. I've now decided to shove all form data into session
globals, and just refresh with a 'load_previous' flag in the URL. I my
form constructor sees this flag, it populates things from session
globals. Otherwise it resets the session globals with defaults.
This seems to be the best solution ( ie the only one that's worked
completely so far ).
Thank you, both of you. Long live Dans!
--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak@xxxxxxxxxxxxxxxxxxxx
website: http://www.nusconsulting.com.au
.
- Follow-Ups:
- Re: [PHP] Re: header( 'refresh' ), form data, and IE
- From: "Daniel Brown"
- Re: [PHP] Re: header( 'refresh' ), form data, and IE
- References:
- header( 'refresh' ), form data, and IE
- From: Daniel Kasak
- Re: header( 'refresh' ), form data, and IE
- From: "Dan"
- Re: [PHP] Re: header( 'refresh' ), form data, and IE
- From: Daniel Kasak
- Re: [PHP] Re: header( 'refresh' ), form data, and IE
- From: "Daniel Brown"
- header( 'refresh' ), form data, and IE
- Prev by Date: Re: [PHP] Variable problem?
- Next by Date: Calling php-cgi.exe
- Previous by thread: Re: [PHP] Re: header( 'refresh' ), form data, and IE
- Next by thread: Re: [PHP] Re: header( 'refresh' ), form data, and IE
- Index(es):
Relevant Pages
|