Hi,
If you wish to move variables from one page to another, there are several ways:
Code:
<a href="page2.php?variable1=yes&variable2=no" title="yes and no">yes and no</a>
This will use the querystring.. (the least secure option)
Or, you can do:
Code:
<form action="page2.php" method="post">
<input type="text" name="variable1" value="yes" />
<input type="text" name="variable2" value="no" />
<input type="submit" name="submit" action="submit" />
</form>
Also, you can do:
Code:
session_start();
if (isset($variable1)) {
$_SESSION['variable1'] = $variable1;
}
if (isset($variable2)) {
$_SESSION['variable2'] = $variable1;
}
If you want a login script, you use the session.
If you want some basic things, it's often easy to use querystring.
If you want the user to log in, or register, or whatever, you use the form, maybe combined with session.
Note for sessions:
On EACH page that you wish to use the session variables that you define, you have to start on the top-most of the page:
session_start();
You can not have any whitespace or anything parsed before that! Or you will get some error "headers already sent" or something like that.
ps. As always, you need to remove unwanted things from your variables, as they might be abused in one way or another.
Olav Alexander Mjelde
Admin & Webmaster