-8

the following error is showing in the web page but the code is working..i just want to know why the following error is showing?

Notice: Use of undefined constant food - assumed 'food' in E:\server\htdocs\table\action.php on line 33 enter image description here

the following links are the code source. https://drive.google.com/open?id=1u59Z0WipMgPEE10KP1c12maoUS-KqhlA https://drive.google.com/open?id=1ngHyhwOdCbryj7UvZ_8tE2pIqp2uoSmE

2 Answers2

1

Even without the code sample where it is happening I believe you are not using quotations ' or " in your array key names.

All you need is to wrap the key name into the quotations such as:

$your_array['food']; 
// or
$your_array["food"]; 
ino
  • 2,345
  • 1
  • 15
  • 27
0

For example on 10 line $dep = $_POST['dep']; I think you get text value. And on 33 line you have if-else operator if($dep==food){. You need to change your right value food to 'food'. Then you haven't get Notice messages. Because all text values must be in single or double quotes.

Your current syntax (with notice) is: comparing variable $dep with constant food.