Why am I having undefined index errors here on my code when I add the sort feature? These are the errors I'm getting
Notice: Undefined index: sort in C:\xampp\htdocs\how are things\admin panel\view.php on line 58
Notice: Undefined index: sort in C:\xampp\htdocs\how are things\admin panel\view.php on line 61
Notice: Undefined index: sort in C:\xampp\htdocs\how are things\admin panel\view.php on line 64
Notice: Undefined index: sort in C:\xampp\htdocs\how are things\admin panel\view.php on line 67
Notice: Undefined index: sort in C:\xampp\htdocs\how are things\admin panel\view.php on line 70
Notice: Undefined index: sort in C:\xampp\htdocs\how are things\admin panel\view.php on line 73
Notice: Undefined index: sort in C:\xampp\htdocs\how are things\admin panel\view.php on line 76
This is the code on the lines 58 61 64 67 70 73 76
$result = "SELECT * FROM customers";
if($_GET['sort'] == 'first_name'){
$result .= " ORDER BY first_name";
}
else if($_GET['sort'] == 'last_name'){
$result .= " ORDER BY last_name";
}
else if($_GET['sort'] == 'address'){
$result .= " ORDER BY address";
}
else if($_GET['sort'] == 'phone_number'){
$result .= " ORDER BY phone_number";
}
else if($_GET['sort'] == 'email'){
$result .= " ORDER BY email";
}
else if($_GET['sort'] == 'city'){
$result .= " ORDER BY city";
}
else if($_GET['sort'] == 'country'){
$result .= " ORDER BY country";
}
$result = mysql_query($result) or die(mysql_error());