Another way.
| From: | Gabriel Peugnet | Date: | Thu, 16 Oct 2003 07:17:56 +0000 |
| Subject: | Another way. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-31054@lists.php.net to get a copy of this message | ||
You can also pass the variable via POST to the script where the function is.
It remains a local variable.
Or you can set it as global like Chris says.
And another way is puting it in a cookie.
"Adam Symonds" <adamsymonds@froggy.com.au> escribió en el mensaje
news:MIEELGBAPLIIGHOJAMMEEEKGCBAA.adamsymonds@froggy.com.au...
> Hi,
> I am starting to us functions with my work but I am having troubles
> With the variables in the functions..
>
> If I have the following function called from my page it will work but the
> variable won't
> ($username)
> but if I put this code straight on the page then it works fine..
>
> Any reason for the variable not to work in the function but in straight
> coding?
> Thanx
>
>
>
> Sample Function Below:
>
> ======================================
> function LoginSystem()
> {
> echo "<div align=right>";
> if ( !isset( $_SESSION['login'] ) ) {
>
> echo "<form action=../Users/Login.php method=post>";
> echo "<font size=1>Username: </font><input name=user type=text
> size=10> <font size=1>Password: </font><input name=pass
> type=password
> size=10> <input type=submit value=GO><br>";
> echo "<a href=../Register.php><font size=1>Not A Member
> Yet?</font></font></a> ";
> echo "</form>";
>
> } else {
> echo "<font size=1>Welcome $username <a
> href=../Users/Logout.php><font
>
> size=1>Logout</a> </font></font><br><br>";
> }
> echo "</div>";
> }
>