Etherwood Posted December 7, 2009 Share Posted December 7, 2009 At the very bottom of my php script you'll see a html link just before the </html>: <a href="main.php">Return To Main</a>. For some reason this is coming up on the page at the top of the page above the php generated table How wierd? <?php session_start(); include("config.php"); include("inc.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Search Employee</title> </head> <div id="main"> <a name="TemplateInfo"></a> <h1>Search Employee</h1> <?php if (isset($_POST['submit'])) { // Form Is Submitted // Validate Search Query if ($_POST['searchquery'] != "") { $searchquery = filter_var($_POST['searchquery'], FILTER_SANITIZE_STRING); if ($searchquery == "") { $errors .= 'Please enter a valid search query.<br/><br/>'; } } else { $errors .= 'Please enter a search query.<br/>'; } // Validate Search Type if ($_POST['searchtype'] != "") { $searchtype = filter_var($_POST['searchtype'], FILTER_SANITIZE_STRING); if ($searchtype == "") { $errors .= 'Please enter a valid search type.<br/><br/>'; } } else { $errors .= 'Please enter a search type.<br/>'; } echo $searchtype; echo $searchquery; // Check For Errors if (!$errors) { $results = mysql_query("SELECT * FROM staffdb WHERE $searchtype LIKE '$searchquery'"); $numrows = mysql_num_rows($results); if ($numrows == 0) { echo "<p>Sorry, your search returned no results</p>"; } else { echo'<table><TR> <TD>Staff ID</TD> <TD>Forname</TD> <TD>Surname</TD> <TD>Department</TD> <TD>Vehicle Reg</TD> <TD>Locker ID</TD> <TD>Locker Key</TD> </TR>'; while ($row = mysql_fetch_array($results)) { echo "<TR> <TD><a href=\"viewemployee.php?id={$row['staffid']}\">{$row['staffid']}</a></TD> <TD>{$row['fname']}</TD> <TD>{$row['sname']}</TD> <TD>{$row['dept']}</TD> <TD>{$row['vehiclereg']}</TD> <TD>{$row['lockerid']}</TD> <TD>{$row['lockerkey']}</TD> </TR>"; } } } else { echo '<div style="color: red">' . $errors . '<br/></div>'; } } else { // No Form Is Submitted ?> <form name="searchemployee" action="searchemployee.php" method="post"> <select name="searchtype"> <option value="fname">Forename</option> <option value="sname">Surname</option> <option value="dept">Department</option> <option value="vehiclereg">Vehicle Reg</option> <option value="lockerid">Locker ID</option> <option value="lockerkey">Locker Key</option> </select> <br/> Search Query*<br /><input type="text" name="searchquery" size="35" /><br /> <input type="submit" name="submit" value="Search Employee" /> </form> <?php } ?> </div> <a href="main.php">Return To Main</a> </body> </html> The HTML output... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Search Employee</title> </head> <div id="main"> <a name="TemplateInfo"></a> <h1>Search Employee</h1> fnametest<table><TR> <TD>Staff ID</TD> <TD>Forname</TD> <TD>Surname</TD> <TD>Department</TD> <TD>Vehicle Reg</TD> <TD>Locker ID</TD> <TD>Locker Key</TD> </TR><TR> <TD><a href="viewemployee.php?id=0">0</a></TD> <TD>test</TD> <TD>test</TD> <TD></TD> <TD>dfgdf</TD> <TD>2345234</TD> <TD>345</TD> </TR><TR> <TD><a href="viewemployee.php?id=0">0</a></TD> <TD>test</TD> <TD>test</TD> <TD></TD> <TD>test</TD> <TD>987</TD> <TD>9879</TD> </TR> </div> <a href="main.php">Return To Main</a> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/184212-html-in-wrong-place/ Share on other sites More sharing options...
Etherwood Posted December 7, 2009 Author Share Posted December 7, 2009 Take a look at this. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/184212-html-in-wrong-place/#findComment-972562 Share on other sites More sharing options...
mikesta707 Posted December 7, 2009 Share Posted December 7, 2009 can you post the css for the "main" div tag Quote Link to comment https://forums.phpfreaks.com/topic/184212-html-in-wrong-place/#findComment-972567 Share on other sites More sharing options...
gaza165 Posted December 7, 2009 Share Posted December 7, 2009 it appears you havent closed your <table> with </table> i am basing this on the screenshot so i may be wrong!! Quote Link to comment https://forums.phpfreaks.com/topic/184212-html-in-wrong-place/#findComment-972569 Share on other sites More sharing options...
Etherwood Posted December 7, 2009 Author Share Posted December 7, 2009 Would are correct, didn't notice that Quote Link to comment https://forums.phpfreaks.com/topic/184212-html-in-wrong-place/#findComment-972574 Share on other sites More sharing options...
PFMaBiSmAd Posted December 7, 2009 Share Posted December 7, 2009 The missing </table> tag is what is causing your most immediate problem. But if you are trying for a XHTML strict doctype, you need to work on the missing <body> tag, the UPPER-CASE tags, and everything else in the HTML output that is resulting in 28 Errors and 2 warning(s) at the w3.org validator. Quote Link to comment https://forums.phpfreaks.com/topic/184212-html-in-wrong-place/#findComment-972579 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.