close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Undefined Index? PHP error.

Thread began 9/16/2015 5:09 am by Nathon Jones Web Design | Last modified 9/17/2015 2:13 am by Ray Borduin | 170 views | 1 replies |

Nathon Jones Web Design

Undefined Index? PHP error.

I have the following on a PHP page:

<?php if ($_GET["auth"] == 1) { ?>
<span class="smallred">You have entered incorrect login credentials, don't have authorisation to view the page you've requested or you have been signed out due to a period of inactivity.</span>
<?php } ?>

If, upon arriving on our index.php page, the querystring "auth" has a value of 1 then this error message is to be displayed. However, if a user simply arrives at this page and no querystring is set we get the following error:

Notice: Undefined index: auth in C:\inetpub\wwwroot\website\admin\index.php on line 45

I only noticed this because I have this at the top of the page:
<?php error_reporting(E_ALL); ini_set('display_errors','on'); ?>

...but I have wee sections of code like this all over the place, on lots of sites. Is my approach wrong?

Thanks for any advice offered.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

You have to use:

php:
<?php if (isset($_GET["auth"]) && $_GET["auth"] == 1) { ?>



you have to check if a variable is set first before checking it's value in php.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...