Re: [PHP-DB] weird php error
Try: if ($_GET['login'] == 'forgot') - Original Message - From: OpenSource [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 29, 2003 7:38 AM Subject: [PHP-DB] weird php error Hi guys, This is weird to me.. I got this script --- ?php if ($_GET[login] == 'forgot') { echo Sorry I forgot my password; } else { echo you are good to go; } ? - when ran, it gives me this error Notice: Use of undefined constant login - assumed 'login' in G:\Inetpub\wwwroot\test\index.php on line 3 Notice: Undefined index: login in G:\Inetpub\wwwroot\test\index.php on line 3 good to go What is this all about? The script look fine to me. Thanks in advance for your support -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] weird php error
On 29 August 2003 06:39, OpenSource wrote: Hi guys, This is weird to me.. I got this script --- ?php if ($_GET[login] == 'forgot') { echo Sorry I forgot my password; } else { echo you are good to go; } - when ran, it gives me this error Notice: Use of undefined constant login - assumed 'login' in G:\Inetpub\wwwroot\test\index.php on line 3 This is because you haven't quoted the array subscript -- PHP thinks you're trying to refer to a constant called login, but on not finding that assumes that you meant the string 'login' instead. To suppress this notice, supply the subscript correctly as a string: if ($_GET['login'] == 'forgot') Notice: Undefined index: login in G:\Inetpub\wwwroot\test\index.php on line 3 This means that there was no login= parameter on the URL that called this script. If this is a permissible condition, you need to allow for it in your code. One way is simply to suppress the error message with the @ operator: if (@$_GET['login'] == 'forgot') Another is to do more explicit checking: if (isset($_GET['login']) $_GET['login'] == 'forgot') Which you use is really down to personal preference. 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: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] weird php error
try if (isset($_GET['login']) AND $_GET['login'] == 'forgot') KD On Fri, 29 Aug 2003, Tiberiu Ardeleanu wrote: Try: if ($_GET['login'] == 'forgot') - Original Message - From: OpenSource [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 29, 2003 7:38 AM Subject: [PHP-DB] weird php error Hi guys, This is weird to me.. I got this script --- ?php if ($_GET[login] == 'forgot') { echo Sorry I forgot my password; } else { echo you are good to go; } ? - when ran, it gives me this error Notice: Use of undefined constant login - assumed 'login' in G:\Inetpub\wwwroot\test\index.php on line 3 Notice: Undefined index: login in G:\Inetpub\wwwroot\test\index.php on line 3 good to go What is this all about? The script look fine to me. Thanks in advance for your support -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php