Hi,
I have a require_once PHP file in my index.php. The index.php file itself calls another .php file via a href link from a table where it provides the row id to pass to the next page’s stored procedure.
my folder Hierarchy looks like this:
my index.php loads the relevant CSS files but when I check in Chrome using DevTools and Network I can see the files do not load.
How can I include all the CSS in each .php file?
I saw a few explanations but I do not really understand.
Then inside the class.php in the last column of each row there is a href link that catches the ‘Id’ of a column to pass to another page with a stored procedure, I call the stored procedure and populate a table. My href:
href="php/class2.php?id= ' ,
The css, js, images or styles.css are not loading in the class2.php
Do you have the same require_once() in class2.php? Once you get to that code via your href link, everything starts again, it won’t carry anything over from the calling html page.
No, the require_once(class.php) is only in my index.php. This class doesn’t have any includes in it because all styles load. class.php is only the class to connect to the DB and call the SP, class2 is another connection to the DB calling another SP.
When I tried to put an include or require in my class2.php the page won’t load at all.
That seems strange, would need to see the code to comment.
But if you don’t include the file that links to all the CSS and so on, it’s no surprise that it doesn’t display. Once you are at the target of your href, that’s a new page for your browser. You have to specify everything you want on it.
Thanks for your help, I realise what I need to do; my code isn’t very clean and I an not using my classes correctly. I am creating and populating each table inside my class and only including the name of the class in my index.php.
I tested by wrapping my class.php with HTML and all pages loaded the styles required, then I realised that if I use my classes to connect to the DB and SP but call the populating tables with POST in my index.PHP, everything works as it should without repeating code.
A very important lesson for me there, thanks for all help provided,