I have a problem where basically, My PHP works fine but it doesn’t output valid strict xhtml. Even though the lists of posts which this script outputs looks ok in my browser it doesn’t validate. It’s closing the <li> tags when they should stay open to receive the next inline <ul> tags. Can anyone help? I’m thinking this is going to take some heavy if statement to resolve.
Cheers
[code=php] if (!isset($_GET[‘MBID’])) exit;
mysql_connect(“”, “”, “”);
mysql_select_db(“”);
function showpost(&$parent) {
extract($parent, EXTR_PREFIX_ALL, “msg”);
$msg_DateSubmitted = date(“jS of F Y”, $msg_DateSubmitted);
echo “t<li><a href=”read.php?Msg=$msg_ID”>$msg_Title</a> posted by <a href=”mailto:$msg_Email”>$msg_Poster</a> on $msg_DateSubmitted</li>n”;
$result = mysql_query(“SELECT ID, Title, Poster, Email, DateSubmitted FROM mbmsgs WHERE MBID = {$_GET[‘MBID’]} AND Parent = $msg_ID ORDER BY DateSubmitted DESC;”);
if (mysql_num_rows($result)) {
echo “t<ul>n”;
while ($row = mysql_fetch_assoc($result)) {
showpost($row);
}
echo “t</ul>n”;
}
}
$result = mysql_query(“SELECT Name FROM mblist WHERE ID = {$_GET[‘MBID’]};”);
if (!$result) exit;
if (!mysql_num_rows($result)) exit;
extract(mysql_fetch_array($result), EXTR_PREFIX_ALL, ‘mb’);
echo “<h2>$mb_Name</h2>n<hr />n”;
echo “<p>Select a post from below</p><p>n”;
$result = mysql_query(“SELECT ID, Title, Poster, Email, DateSubmitted FROM mbmsgs WHERE MBID = {$_GET[‘MBID’]} AND Parent = 0 ORDER BY DateSubmitted DESC;”);
if (!$result) exit;
if (!mysql_num_rows($result)) {
echo “<p>This messageboard has no posts.</p>”;
} else {
echo “<ul>n”;
while ($row = mysql_fetch_assoc($result)) {
showpost($row);
}
echo “</ul>n”;
}
?>