Jump to content


This topic is now archived and is closed to further replies.

glenn kilpatrick

My very first php - guess what it doesnt work

Recommended Posts

Hi Everyone,

I have just done my very first piece of php - an include menu file. To be honest I was shocked to see it never worked. Your help would be much appreciated here.

This is the code I used in my index file which can be viewed at www.whitbyseaanglers.co.uk

<?php include("menu.php"); ?>

This is the code in a file named menu.php on my server in the same directory.


<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>

<ul id="nav">

<li><a href="index.htm">&nbsp;&nbsp;&nbsp;&nbsp; Home</a>

<li>About Us
<li><a href="aboutus.htm">Club Details</a></li>
<li><a href="history.htm">History</a></li>


<li>&nbsp;Club Stats
<li><a href="results.htm">Results
<li><a href="positions.htm">Positions</a></li>
<li><a href="05-06individualcatches.htm">Angler Stats</a></li>

<li>&nbsp; Galleries
<li><a href="gallery.htm">Gallery</a></li>
<li><a href="pictures.htm">NE Gallery</a></li>
<li><a href="friendsgallery.htm">Friends</a></li>


<li><a href="archives.htm">Archives</a></li>

<li>Site Map

<li><a href="calendar.htm">Calendar</a></li>

<li> Contact
<li><a href="mailto:whitbyseaanglers@ntlworld.com?subject=Fishing Club">Email</a></li>
<li><a href="guestbook">Guestbook</a></li>
<li><a href="http://wsaa.proboards106.com/index.cgi">Message Board</a></li>

<li>Useful Info
<ul style="position: absolute; left: 0px; top: 19px">
<li><a href="http://www.pol.ac.uk/ntslf/tides/?port=0174">Tides</a></li>
<li><a href="links.htm">Links</a></li>
<li><a href="sitemap.htm">Site Map</a></li>
<li><a href="sizelimits.htm">Size Limits</a></li>
<li><a href="bait.htm">Bait</a></li>
<li><a href="peelers.htm">Peelers</a></li>
<li><a href="http://homepage.ntlworld.com/lisa.broadley/fishingatwhitby/index">Fishing at Whitby</a></li>
<li><a href="http://whitbyseaanglers.blogspot.com/">GlennBlog</a></li>



??? ??? ??? ??? ??? ???

Would someone please let me know where I am going wrong. Kind regards - Glenn

Share this post

Link to post
Share on other sites

The menu doesnt appear.

There should be a menu just below the header image.

Have a look at www.whitbyseaanglers.co.uk The menu hasnt been included.

Share this post

Link to post
Share on other sites
Hi All,

Glen, can you be more specific please. I've put together your files and they appear to work, though your menu system still requires a lot of work.

One point though; when you include a file, remove all the extraneous HTML tags. For instance, after your page has been executed on the server, it shouldn't show multiple BODY or HEAD tags.


Please also mention the server/software/setup that you have for future reference i.e. phpMyAdmin or EasyPHP, etc, etc


Share this post

Link to post
Share on other sites
Insert this little bit of code before you include your menu...
that should issue a notice if your included file isn't being included. If you read the PHP manual you'd see that the big difference between include and require is that include will fail and issue a notice, whereas require will fail and issue a fatal error and this stopping execution of the script. You wouldn't want your page to load without the menu would you? So you should be using require.....and it just seems best practice to use require_once, since you wouldn't want to include that menu more than one time in the script would you?

It's best practice to set error_reporting to E_ALL to catch all notices and such when you're debugging your system. This really comes in handy with the more complex scripts and helps you catch things like undefined variables which could be the reason why a script doesn't run right.

Your menu.php file appears to be just straight html. Why not just rename it with an html extension instead of php? Is there some reason you want this to be parsed by php?

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.