RE: [PHP] SESSION variable to pass login ID
| From: | Ford, Mike [LSS] | Date: | Mon, 13 Jan 2003 14:25:21 +0000 |
| Subject: | RE: [PHP] SESSION variable to pass login ID | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-131437@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Nova [mailto:nova@zhisoft.com]
> Sent: 12 January 2003 20:04
>
> This statement doesnt look right to me.
>
> if(isset($_POST['userid']) && isset($_POST['pword'])){
> $_SESSION['user'] = $_POST['userid'];
> $_SESSION['password'] = $_POST['pword'];
> }
Nowt wong wi' that!
>
> the if should be:
>
> if ((statement)&&(statement))
That's not true! The syntax of "if" is:
if (expression) statement;
and one possible expression is:
expression && expression
so this is a valid if condition:
if (expression && expression)
Now, you *may* need additional parentheses around the expressions if they
contain lower-priority operators than &&, but they are not required.
Also: a statement is *not* an expression, so the if condition can never
include statements!
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211