Page 1 of 1

Suggestions...

Posted: Fri May 23, 2003 6:21 am
by mikusan
I just finished an email sending form that will check email, correct imput fields and what not, now when i check for some of these things i redirect people after giving them a warning using javascript, but now ned a way to preserve the input the users have put in.

For this scenario sessions (i dunno u tell me) is not useful because the security level is low and it wouldn't matter here all sensible information is witheld by my php. I was thinking of using hidden fields but they are not "quite" hidden as you can see them in the source, not that i care or anything, but is that common? to store form variables in the hidden input?

How long do the $_POST variables live? i mean they are passed when the form action'' is specified, but do they die if you click another link, or for that same reason are redirected?

Posted: Fri May 23, 2003 6:31 am
by mikusan
To better protray what is going on...

Code: Select all

$output = ' <BODY onLoad=window.setTimeout("location.href=''email.php?action=missingentry''",5000)>
				<B>You have <b>not</b> filled in all the fields<B>
				<BR><BR>
				<small><b>Note:</b>This window will redirect in 5 seconds<BR><BR>
				To go back and fix your entries <a href="email.php?action=missingentry">click here</a></small>
				</BODY>';
Where would the form go, and how would i assure that the form will actually pass the values since i am not clicking on submit, and does the action="" part of the form actually do anything since the page will redirect anyways?

oh and yes, i know that is not 5 seconds :wink:

Posted: Fri May 23, 2003 6:32 am
by tr3s
to pass variables from page to page then you should use session.

e.g.

Code: Select all

<?php
   session_start();
   $_SESSION['var'] = $var;
?>
refer to the manual for more...

good luck!

Posted: Fri May 23, 2003 6:34 am
by mikusan
hmm i already have sessions running for my site, mainly for people that log in, but i am not sure i need to start a sessions for a small thing like this one, besides it is't designed for logged in users. maybe i am getting ahead of myself, shoud i really use sessions?

i was hoping not to use sessions in this case for once because i am using a javascript redirect and that will cause problems with outputting header info with sessions...

Posted: Fri May 23, 2003 10:19 am
by liljester
once the form is successfully added to the database you can destory the session (session_destroy();), then when they log in, they would get a fresh set of session vars