Jump to content


My very first php - guess what it doesnt work

  • Please log in to reply
6 replies to this topic

#1 glenn kilpatrick

glenn kilpatrick
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 09 July 2006 - 10:15 AM

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.proboard...ex.cgi">Message Board</a></li>

<li>Useful Info
<ul style="position: absolute; left: 0px; top: 19px">
<li><a href="http://www.pol.ac.uk...>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.ntlw.../index">Fishing at Whitby</a></li>
<li><a href="http://whitbyseaangl...nnBlog</a></li>



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

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

#2 redarrow

  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 09 July 2006 - 10:20 AM

Dont understand your problam if got one.
Wish i new all about php DAM i will have to learn

#3 glenn kilpatrick

glenn kilpatrick
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 09 July 2006 - 10:29 AM


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.

#4 digitalgod

  • Members
  • PipPipPip
  • Advanced Member
  • 374 posts

Posted 09 July 2006 - 10:32 AM

try renaming your index.htm to index.php

#5 Gummie

  • Members
  • PipPip
  • Member
  • 13 posts

Posted 09 July 2006 - 05:57 PM

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


#6 robos99

  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 09 July 2006 - 06:50 PM

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?

#7 Daniel0

  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 09 July 2006 - 06:56 PM

It works for me...

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users