0
$func=$_GET['func']?$_GET['func']:$_POST['func'];

While calling this function following error is showing

Notice: Undefined index: func in C:\wamp\www\Web Engg final project\phplogin.php on line 2

this error us showing ?

Pupil
  • 23,834
  • 6
  • 44
  • 66
  • [Undefined index](http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php/12770836#12770836). You're trying to make reference to `$_GET['func']` when it's not available. On page load both `$_GET['func']` and `$_POST['func']` are not available, you will need to check to see if they exist before using as setters. – Bankzilla May 09 '16 at 04:24

1 Answers1

0

It seems, you are not getting $_GET['func'] also $_POST['func'].

You are assuming that if $_GET['func'] is not set, there will be $_POST['func'].

Instead of it, add a logic:

1) Create a new variable $func, default it to blank.

2) If isset($_GET['func']), assign to it.

3) If isset($_POST['func']), assign to it.

Code:

$func = '';
if (isset($_GET['func'])) {
 $func = $_GET['func'];
}
else if (isset($_POST['func'])) {
 $func = $_POST['func'];
}
Pupil
  • 23,834
  • 6
  • 44
  • 66