Hey, I'm learning PHP, but I got a problem. When I try to include my menu in all pages in a table cell, through the include command, I do it like this: <?php include("menu.php"); ?> Now, I made the menu.php with <html> and <body> tags around it, and also tried it without those tags, but still, the menu.php doesn't show. Someone know what I do wrong? Thanks!
A) Not a good practice to use short tags (<?). B) Always use brackets () to make the code readable. The above code is perfectly fine and show work, try: A) Viewing source B) Change include to require, maybe an error might pop up Peace,
shrug. I haven't seen a host not support short tags in years. the parens in includes just look messy to me. personal preference I guess. from what it looks like I'm guessing php isn't even being parsed. if it's not, you should be able to see the actual php code when you view the source. if you can't see it then you probably have error suppression on somewhere.
make sure you backslashed your " in your html... not sure if this even applies to yours, but this is the mistake I always make
You can also make the code like this: <?php @include("menu.php"); ?> //This is if you don't want errors to show up on the page, if you code doesn't work right.
I think the correct syntax is <?php include("menu.php"); ?> Check it that it is in the same folder or elsewhere.... If it's in abc folder then the syntax will be : <?php include("abc/menu.php"); ?>
The PHP is in the same folder, and the syntax is correct. When I open the index page, it still shows nothing, but when I surf to /menu.php with IE, I get to see the menu... Any other ideas, anyone?
Right. I just can't figure it out. Would someone be willing to review my source code? You'll find it at here. And the menu.php, header.php and right column. Thanks in advance.