Page 1 of 1

Best way to pass variables ?

Posted: Mon Aug 16, 2004 10:51 pm
by SBro
Hi, I was just wondering what the best method is to pass variables in php. I know how to pass variabes, but the problem is this; I have a number of form elements (around 20) that I am passing between a couple of pages and eventually using to structure an e-mail. The concern I have is that by the end of passing all the variables I will have a stupidly long address with (20) "&var=$blah". I'm not sure whether this is particularly a problem, just wondering if there was a better or alternate way to do this.

If possible I don't want to use a database for this as there is no real need to keep the values from the form(s) after the end e-mail has been sent. I was also thinking of cookies, but not sure whether that would be a better method or not? thanks.

Steve.

Posted: Mon Aug 16, 2004 10:55 pm
by feyd
[php_man]sessions[/php_man]

Posted: Tue Aug 17, 2004 4:17 am
by CoderGoblin
I agree sessions is the way to go.

NOTE: passing the parameters as POST rather than GET is more secure and does not increase the length of the address. GET also has a much smaller limit as to the amount of data you can pass. ('<form action="XXX" method="POST">')

Posted: Tue Aug 17, 2004 4:55 pm
by tim
again, the link to the session tutorial written by jason would be handy if there was such a link again

:evil: :roll: :wink: