0

I'm trying out the program the first time and I get errors and warnings that should not be there. because the page loads up just fine. I have screenshots. categories.php

Undefined variable '$connection'
Path 'inc/header.php' not found
Path 'inc/nav.php' not found
Path 'inc/footer.php' not found

are the ones I'm talking about cat.php screenshot

db.php screenshot the warrings are valid code. db.php screenshot

header.php is valid too header.php screenshot

Refactoring seems to be not working I provided a screenshot Refactoring screenshot

and is there a way to fix a code typo automatically or to see how it should be spelled?

1
  • The title of this question will not do a good job of connecting researchers with the specific scope of this question (questions). Apr 6, 2021 at 23:41

1 Answer 1

0

I'll take a stab at some of the issues in your cat.php screenshot of C:\wamp64\www\CMS\admin\categories.php

  • line 5 (path not found) The relative path in your include resolves to C:\wamp64\www\CMS\admin\inc\nav.php since "categories.php" is in the "admin" directory. And phpStorm is correct: that file does not exist. Change line 5 to say include __DIR__ . '/../inc/nav.php
    I suspect that is the same issue with the header include on line 1 and the href links your header.php file.
  • line 15 (wrong attribute value) - method should be "post" or "get" (typically)
  • line 18 (missing associated label) - Add an id=cat-title attribute to your <input> tag.
  • I don't have enough info to comment on the other issues
1
  • 1
    Once the include problem is solved, PHPStorm will realize that the $connection variable was defined elsewhere and stop complaining. To stop this particular complaint without actually fixing anything, one could also specify that the variable does exist by adding at the top of the file, global $connection;
    – LSerni
    Jun 3, 2021 at 22:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .