-3

The following code has been moved to a new server and is throwing this error:

Notice: Undefined variable: menu in * on line 128
Notice: Undefined variable: menu in * on line 160
Notice: Undefined variable: menu in * on line 170

Here is the code:

<a href="index.php?menu=profile">Profile</a>
<a href="index.php?menu=regisztracio">Regisztráció</a>
<a href="index.php?menu=kapcsolat">Kapcsolat</a>
<?php switch($menu)
{
    case "profile":
    {
        echo("profil");
    }
    case "regisztracio":
    {
        echo("regisztráció");
    }
    case "kapcsolat":
    {
        echo("kapcsolat");
    }
    default:
    {
        echo("Home page");
    }
}
?>
salathe
  • 50,055
  • 11
  • 103
  • 130

3 Answers3

1

I didn't understand your lang but the problrem is you are not using $_GET['menu'] to retrieve the GET parameter.

$menu = $_GET['menu'];
switch($menu) {
....
}
Yogesh Suthar
  • 30,136
  • 18
  • 69
  • 98
1
<a href="index.php?menu=profile">Profile</a>

<a href="index.php?menu=regisztracio">Regisztráció</a>

<a href="index.php?menu=kapcsolat">Kapcsolat</a>

here "menu " is not a php variable. You should pass value as $menu to switch ( $menu = $_GET['menu']; ). Not "menu" to switch.

Balaji Kandasamy
  • 4,165
  • 10
  • 38
  • 58
0

$menu is undefined.

It is not set anywhere, e.g.

$menu  = "profile";
Jake N
  • 10,330
  • 9
  • 60
  • 108