include file does not work with one page!?
Moderator: General Moderators
include file does not work with one page!?
Hello all,
I am pretty new to programming with php, but I can program in other languages. I currently have a website that is running off iis, asp and mysql that i'm trying to convert to apache, php and mysql. So here is the problem I'm having, I have an include file that inserts my logo and links onto every page, however this include file causes one of my pages not to load. The page loads fine without the include file and the include file works with every other page. On the troubled page I have two mysql connections, one loads a combo box the other displays the result of what the user selects in the combo box, could this be the problem? I also have another include file that loads on this page that works fine. Basically I have tried everything that I know to do, so any suggestions would help. I include the file this way:
include("./Include/Nav.inc");
Thanks in advance
I am pretty new to programming with php, but I can program in other languages. I currently have a website that is running off iis, asp and mysql that i'm trying to convert to apache, php and mysql. So here is the problem I'm having, I have an include file that inserts my logo and links onto every page, however this include file causes one of my pages not to load. The page loads fine without the include file and the include file works with every other page. On the troubled page I have two mysql connections, one loads a combo box the other displays the result of what the user selects in the combo box, could this be the problem? I also have another include file that loads on this page that works fine. Basically I have tried everything that I know to do, so any suggestions would help. I include the file this way:
include("./Include/Nav.inc");
Thanks in advance
Here is the code I have in the page that does not work. I have the include file commented out so the page will load.
Admin Edit: PHP tags added for clarity and spaces added to allow wrapping
Code: Select all
</head>
<body bgcolor="#60605f" vlink="purple">
<script language="javascript">
function submitform(){
document.shows.submit()
}
</script>
<?php
#include("./Include/Nav.inc");
$db = mysql_connect("Localhost", "UserName", "Password");
mysql_select_db("Table", $db);
?>
<Form id=shows name=shows method=get action="shows.php">
<P align="center">
Select Band:
<SELECT id=Band style="WIDTH: 250" name=Band onchange="submitform()">
<OPTION selected></OPTION>
<?php
$bands = mysql_query("Select BandName, BandID From Band Order By BandName", $db);
while ($myrow = mysql_fetch_array($bands)){
printf ("<option value='%s'>%s</option>", $myrow["BandID"], $myrow["BandName"]);
}
?>
</SELECT>
Or View All By:
<SELECT id=order style="WIDTH: 138px" name=order onchange="submitform()">
<OPTION selected></OPTION>
<OPTION value="Date">Date</OPTION>
<OPTION value="Venue">Venue</OPTION>
<OPTION value="BandName">Band</OPTION>
<OPTION value="Event">Event</OPTION>
<OPTION value="State">State</OPTION>
</SELECT>
</P>
</Form>
<?php
echo "<Table border='1' align='center'>";
echo "<tr> <td> <B>Band </td> <td> <B>Date</td> <td><B>Venue</td> <td><B>City</td> <td><B>State</td> <td><B>Event</td> <td><B>Comment</TD> <td>Format</td> </tr>";
$result = mysql_query("SELECT b.BandName, Date, city, state, venue, event, comment, format FROM Band b inner join Shows s on s.bandid = b.bandid order by BandName, Date", $db);
while ($myrow = mysql_fetch_array($result)){
printf ("<tr> <td>%s</td> <td nowrap>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> </tr>\n", $myrow["BandName"], $myrow["Date"], $myrow["venue"], $myrow["city"], $myrow["state"], $myrow["event"], $myrow["comment"], $myrow["format"]);
}
echo "</table>";
include("./Include/Bottom.inc");
?>
</body>Here is the code for the include file, it is a little hard to read because it was generated by fireworks.
Admin Edit: CODE tags added for clarity and coordinates removed from <area> tags to allow the page to wrap.
Code: Select all
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.framesїn.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=dїn])&&d.all) x=d.allїn]; for (i=0;!x&&i<d.forms.length;i++) x=d.formsїi]їn];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layersїi].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(argsї2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = argsї3]; img.MM_dn = img.src;
if ((nbArr = documentїgrpName]) == null) nbArr = documentїgrpName] = new Array();
nbArrїnbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(argsїi])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = argsїi+1];
nbArrїnbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(argsїi])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && argsїi+2]) ? argsїi+2] : ((argsїi+1])?argsїi+1] : img.MM_up);
nbArrїnbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOverїi]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == "down") {
nbArr = documentїgrpName];
if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArrїi]; img.src = img.MM_up; img.MM_dn = 0; }
documentїgrpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(argsїi])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (argsїi+1])? argsїi+1] : img.MM_up;
nbArrїnbArr.length] = img;
} }
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (aїi].indexOf("#")!=0){ d.MM_pїj]=new Image; d.MM_pїj++].src=aїi];}}
}
//-->
</script>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="501" align="center">
<!-- fwtable fwsrc="JamPhanLight.png" fwbase="JamPhanLight.gif" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="0" -->
<tr>
<td><img src="images/spacer.gif" width="106" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="73" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="34" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="81" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="29" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="71" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="68" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="38" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td>
</tr>
<tr>
<td rowspan="3"><img name="JamPhanLight_r1_c1" src="images/JamPhanLight_r1_c1.gif" width="106" height="225" border="0" alt=""></td>
<td rowspan="3"><img name="JamPhanLight_r1_c2" src="images/JamPhanLight_r1_c2.gif" width="73" height="225" border="0" usemap="#m_JamPhanLight_r1_c2" alt=""></a></td>
<td colspan="6"><img name="JamPhanLight_r1_c3" src="images/JamPhanLight_r1_c3.gif" width="321" height="33" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="33" border="0" alt=""></td>
</tr>
<tr>
<td colspan="3"><img name="JamPhanLight_r2_c3" src="images/JamPhanLight_r2_c3.gif" width="144" height="1" border="0" alt=""></td>
<td rowspan="2"><img name="JamPhanLight_r2_c6" src="images/JamPhanLight_r2_c6.gif" width="71" height="192" border="0" usemap="#m_JamPhanLight_r2_c6" alt=""></td>
<td rowspan="2" colspan="2"><img name="JamPhanLight_r2_c7" src="images/JamPhanLight_r2_c7.gif" width="106" height="192" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td>
</tr>
<tr>
<td><img name="JamPhanLight_r3_c3" src="images/JamPhanLight_r3_c3.gif" width="34" height="191" border="0" usemap="#m_JamPhanLight_r3_c3" alt=""></td>
<td><img name="JamPhanLight_r3_c4" src="images/JamPhanLight_r3_c4.gif" width="81" height="191" border="0" usemap="#m_JamPhanLight_r3_c4" alt=""></td>
<td><img name="JamPhanLight_r3_c5" src="images/JamPhanLight_r3_c5.gif" width="29" height="191" border="0" usemap="#m_JamPhanLight_r3_c5" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="191" border="0" alt=""></td>
</tr>
<map name="m_JamPhanLight_r1_c2">
<area shape="poly" coords="xxx" href="http://www.jamphan.com" title="home" alt="home" >
<area shape="poly" coords="0,211,14,248,52,248,73,215,61,-19,27,-10,0,211" href="/Pics.php" alt="" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over', 'JamPhanLight_r1_c2', 'images/JamPhanLight_r1_c2_f6.gif', 'images/JamPhanLight_r1_c2_f7.gif', 1);" onClick="MM_nbGroup('down', 'navbar1', 'JamPhanLight_r1_c2', 'images/JamPhanLight_r1_c2_f7.gif', 1);" >
</map>
<map name="m_JamPhanLight_r2_c6">
<area shape="poly" coords="xxx" href="http://www.jamphan.com" title="home" alt="home" >
<area shape="rect" coords="12,167,63,189" href="/MessageBoard.php" alt="" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','JamPhanLight_r2_c6', 'images/JamPhanLight_r2_c6_f2.gif', 'images/JamPhanLight_r2_c6_f3.gif', 1);" onClick="MM_nbGroup('down', 'navbar1', 'JamPhanLight_r2_c6', 'images/JamPhanLight_r2_c6_f3.gif', 1);" >
</map>
<map name="m_JamPhanLight_r3_c3">
<area shape="poly" coords="xxx" href="http://www.jamphan.com" title="home" alt="home" >
</map>
<map name="m_JamPhanLight_r3_c4">
<area shape="poly" coords="xxx" href="http://www.jamphan.com" title="home" alt="home" >
<area shape="rect" coords="10,168,65,184" href="/Shows.php" alt="" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over', 'JamPhanLight_r3_c4', 'images/JamPhanLight_r3_c4_f2.gif', 'images/JamPhanLight_r3_c4_f3.gif', 1);" onClick="MM_nbGroup('down', 'navbar1', 'JamPhanLight_r3_c4', 'images/JamPhanLight_r3_c4_f3.gif', 1);" >
</map>
<map name="m_JamPhanLight_r3_c5">
<area shape="poly" coords="xxx" href="http://www.jamphan.com" title="home" alt="home" >
</map>
</table>-
Stoneguard
- Forum Contributor
- Posts: 101
- Joined: Wed Aug 13, 2003 9:02 pm
- Location: USA
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Firstly, any <script> tags should be in the main <head></head> tags - you need to strip these out from the included file and put them into the main page.
Your page tags should be structured something like:
It would be useful if you checked the source of the page once it's loaded and tell us what is there.
Mac
Your page tags should be structured something like:
Code: Select all
<html>
<head>
<title>Page Title</title>
<script language="Javascript">
// all Javascript functions here including those for the navigation
</script>
</head>
<body>
// include file
// rest of page content
</body>
</html>Mac
-
Stoneguard
- Forum Contributor
- Posts: 101
- Joined: Wed Aug 13, 2003 9:02 pm
- Location: USA
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK