Suggestions...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mikusan
Forum Contributor
Posts: 247
Joined: Thu May 01, 2003 1:48 pm

Suggestions...

Post 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?
User avatar
mikusan
Forum Contributor
Posts: 247
Joined: Thu May 01, 2003 1:48 pm

Post 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:
Last edited by mikusan on Fri May 23, 2003 6:32 am, edited 1 time in total.
tr3s
Forum Newbie
Posts: 17
Joined: Mon May 19, 2003 10:29 am
Location: Philippines
Contact:

Post 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!
User avatar
mikusan
Forum Contributor
Posts: 247
Joined: Thu May 01, 2003 1:48 pm

Post 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...
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Post 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
Post Reply