Matt Ridge Posted January 9, 2012 Share Posted January 9, 2012 I have written a page that works perfectly on showing the data I need in question. The problem is my footer is showing up as my header... I don't know why. Can someone explain? I put it at the end of the page, after all the php code, and it seems to me it should be inserted there, but for some reason it shows on the top. If anyone can help it be greatly appreciated. Here is the page: http://kaboomlabs.com/testbed/print.php?id=1 Here is the code: <?php require_once('tb/connectvars.php'); echo '<div id="printwrap">' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>PDI NCMR - Print</title> <link rel="stylesheet" type="text/css" href="tb/postie.css" /> </head> <body> <div id="logo"> <img src="tb/PDI_Logo_2.1.gif" alt="PDI Logo" /> </div> <?php // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // Grab the profile data from the database if (!isset($_GET['id'])) { $query = "SELECT * FROM ncmr WHERE id = '$id'"; } else { $query = "SELECT * FROM ncmr WHERE id = '" . $_GET['id'] . "'"; } $data = mysqli_query($dbc, $query); if (mysqli_num_rows($data) == 1) { // The user row was found so display the user data $row = mysqli_fetch_array($data); echo'<div id="title"><h3 id="NCMR2">Non-Conforming Materials Report (NCMR: ' . $row['rma'] . ')</h3></div>'; echo '<form id="all">'; echo '<fieldset>'; //Part, Rev, Part Description, NCMR Qty echo '<div id="box1p">'; if (empty($row['ab'])) $row['ab'] = "Empty"; if (empty($row['date'])) $row['date'] = "Empty"; if (empty($row['part'])) $row['part'] = "Empty"; if (empty($row['rev'])) $row['rev'] = "Empty"; if (empty($row['partdesc'])) $row['partdesc'] = "Empty"; if (empty($row['ncmrqty'])) $row['ncmrqty'] = "Empty"; echo '<div id="abp"><span class="b">Added By: </span>' . $row['ab'] . '</div>'; echo '<div id="datep"><span class="b">Date Filed: </span>' . $row['date'] . '</div>'; echo '<div id="partp"><span class="b">Part Number: </span>' . $row['part'] . '</div>'; echo '<div id="revp"><span class="b">Part Revision: </span>' . $row['rev'] . '</div>'; echo '<div id="partdescp"><span class="b">Part Description: </span>' . $row['partdesc'] . '</div>'; echo '<div id="ncmrqtyp"><span class="b">NCMR Qty: </span>' . $row['ncmrqty'] . '</div>'; echo '</div>'; //Part, Rev, Part Description, NCMR Qty, JO, SN and INV echo '<div id="box2p">'; if (empty($row['comp'])) $row['comp'] = "Empty"; if (empty($row['ncmrid'])) $row['ncmrid'] = "Empty"; if (empty($row['rma'])) $row['rma'] = "Empty"; if (!empty($row['NCMR_Qty'])) $row['NCMR_Qty'] = "Empty"; echo '<div id="comp"><span class="b">Company: </span>' . $row['comp'] . '</div>'; echo '<div id="ncmrid"><span class="b">Customer NCMR ID: </span>' . $row['ncmrid'] . '</div>'; echo '<div id="rma"><span class="b">Internal RMA: </span>' . $row['rma'] . '</div>'; echo '<div id="jno"><span class="b">Job #: </span>' . $row['jno'] . '</div>'; echo '</div>'; //Inventory On Hand, Inventory Check, Supplier Name, Supplier Number, Manufacturer Part Number, Manufactuer Serial Number and NCMR ID echo '<div id="box3p">'; if (empty($row['fdt'])) $row['fdt'] = "Empty"; if (empty($row['cof'])) $row['cof'] = "Empty"; echo '<h2>Failures</h2>'; echo '<div id="fdt"><span class="b">Failure Due To: </span><br />' . $row['fdt'] . '</div>'; echo '<div id="cof"><span class="b">Class of Failure: </span><br />' . $row['cof'] . '</div>'; echo '</div>'; //Nonconformity, Disposition, Comments and Comments & Additional Details echo '<div id="box4p">'; if (empty($row['fab1'])) $row['fab1'] = "Empty"; if (empty($row['fab2'])) $row['Disposition'] = "Empty"; if (empty($row['fab3'])) $row['Comments'] = "Empty"; echo '<h2>Fabricators</h2>'; echo '<div id="fab1"><span class="b"></span>' . $row['fab1'] . '</div>'; echo '<div id="fab2"><span class="b"></span>' . $row['fab2'] . '</div>'; echo '<div id="fab3"><span class="b"></span>' . $row['fab3'] . '</div>'; echo '</div>'; //PO, PO Date, and Date Recieved echo '<div id="box5p">'; if (empty($row['non'])) $row['non'] ="Empty"; if (empty($row['dis'])) $row['dis'] ="Empty"; if (empty($row['comm'])) $row['comm'] ="Empty"; if (empty($row['caad'])) $row['caad'] ="Empty"; echo '<div id="non"><span class="b">Nonconformity: <br /></span>' . $row['non'] . '</div><br /><br />'; echo '<div id="dis"><span class="b">Disposition: <br /></span>' . $row['dis'] . '</div><br /><br />'; echo '<div id="comm"><span class="b">Comments: <br /></span>' . $row['comm'] . '</div><br /><br />'; echo '<div id="caad"><span class="b">Comments and/or Additional Details: <br /></span>' . $row['caad'] . '</div>'; //PO, PO Date, and Date Recieved echo '<div id="podrp">'; if (empty($row['po'])) $row['po'] ="Empty"; if (empty($row['pod'])) $row['pod'] ="Empty"; if (empty($row['dri'])) $row['dri'] ="Empty"; echo '<div id="pop"><span class="b">PO: </span>' . $row['po'] . '</div>'; echo '<div id="podp"><span class="b">PO Date: </span>' . $row['pod'] . '</div>'; echo '<div id="drip"><span class="b">Date Recieved: </span>' . $row['dri'] . '</div>'; echo '</div>'; echo '</div>'; echo '<div id="box6p">'; //NCMR Supplier Response & Comment if not empty if (empty($row['ncmrsr'])) $row['ncmrsr'] ="Empty"; if (empty($row['ncmrsc'])) $row['ncmrsc'] ="Empty"; echo '<div id="ncmrsr"><span class="b">NCMR Supplier Response:</span><br />' . $row['ncmrsr'] . '</div><br /><br />'; echo '<div id="ncmrsc"><span class="b">NCMR Supplier Comment:</span><br />' . $row['ncmrsc'] . '</div><br /><br />'; echo '</div>'; echo '</fieldset>'; echo '</div>'; echo '</form>'; } mysqli_close($dbc); echo '</div>'; require_once('tb/pfooter.php'); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/254656-footer-showing-up-as-header/ Share on other sites More sharing options...
thewebsolutionprovider Posted January 9, 2012 Share Posted January 9, 2012 Hello, this will be a CSS issue not PHP. You need to look in your XHTML and CSS to find out a) If you missed some closing tags b) Are the html elements stacked in the code correctly c) Have you added something to your css, such as absolute or fixed positioning to the footer that could cause this to happen. Quote Link to comment https://forums.phpfreaks.com/topic/254656-footer-showing-up-as-header/#findComment-1305772 Share on other sites More sharing options...
Muddy_Funster Posted January 9, 2012 Share Posted January 9, 2012 you seem to be closing 1 too many div's after either </fieldset> or mysqli_close($dbc) Quote Link to comment https://forums.phpfreaks.com/topic/254656-footer-showing-up-as-header/#findComment-1305774 Share on other sites More sharing options...
Matt Ridge Posted January 9, 2012 Author Share Posted January 9, 2012 Hello, this will be a CSS issue not PHP. You need to look in your XHTML and CSS to find out a) If you missed some closing tags b) Are the html elements stacked in the code correctly c) Have you added something to your css, such as absolute or fixed positioning to the footer that could cause this to happen. part a: everything is closed, trust me I spent enough time on this I can account for every open and closed item in the sheet, I can tell you where it closes if you ask too. part b: Yes they are. part c: my CSS has everything set up as relative, as for the positioning of the footer Here is the CSS code for it: .pfooter{ text-align: center; font-family: sans-serif; font-size: 10px; } Quote Link to comment https://forums.phpfreaks.com/topic/254656-footer-showing-up-as-header/#findComment-1305804 Share on other sites More sharing options...
Muddy_Funster Posted January 9, 2012 Share Posted January 9, 2012 you seem to be closing 1 too many div's after either </fieldset> or mysqli_close($dbc) ok, what div's are you closing at the affore mentioned possitions. also, your PHP is opening a div before you have even called the HTML opening tag which I then assume is being closed somewhere within the BODY tag...that can't be good. Quote Link to comment https://forums.phpfreaks.com/topic/254656-footer-showing-up-as-header/#findComment-1305821 Share on other sites More sharing options...
KevinM1 Posted January 9, 2012 Share Posted January 9, 2012 It's difficult to see the problem (aside from you opening a <div> before your <html> tag) because you echo the majority of your HTML, causing it to be one long line of unformatted code. You're much better served doing all of your data processing first, storing the results in variables, and then writing a real HTML page where you can simply plug those variables into the appropriate spot. That will allow you to format your code, making it easier for everyone to read. Quote Link to comment https://forums.phpfreaks.com/topic/254656-footer-showing-up-as-header/#findComment-1305886 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.