wright67uk Posted June 27, 2011 Share Posted June 27, 2011 Im running my source code (generated from the two scripts below) the first script doesnt validate and I get the follwing message; name character invalid: only delimiter ">", delimiter "[", "CDATA", "NDATA", "SDATA" and parameter separators are allowed …ml1/DTD/xhtml1-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" … The second script is using the same doctype but validates fine. Any ideas why? first page (not validating) is http://www.1pw.co.uk/VALETING.php?title=TITLE GOES HERE&subtype=VALETING <!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"> <head> <?php include($_SERVER['DOCUMENT_ROOT'].'/include/db.php'); ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </style> <link href="header.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- p.link { margin-top:0px; padding:0px; color:#3F3; } a.default { text-decoration: underline; } --> </style></head> <body> <div id="bodywrap"> <div id="banner"> <div id="bannerleft"></div> <div id="logo"><img src="i-stevenage.png" height="100%" width="100%" alt="I-stevenage"/></div> <div id="bannerright"><div id="navbar" title=""> <div id="b1"><p class="centre"><a href="b.php">Directory</a></p></div> <div id="b2"><p class="centre"><a href="newbusiness.php">Add Your Business</a></p></div> <div id="b3"><p class="centre"><a href="contact.html">Contact Us</a></p></div> </div><!-- end of navbar--> </div><!--end of bannerright--> </div><!-- end of banner--> <div id="listhold"> <?php $subtype = $_GET['subtype']; $subtype = ucwords (strtolower($subtype)); echo "<h1>$subtype</h1>"; $query = "SELECT name, phone, email, WebAddress, postcode FROM business WHERE subtype ='$subtype' AND confirmed ='Yes' ORDER BY name"; if( $result = mysql_query($query) ) { echo mysql_error(); while($row = mysql_fetch_assoc($result) ) { foreach( $row as $k => $v ) { if( empty($v) ) { unset($row[$k]); } } if( !empty($row['postcode']) ) { $row['postcode_link'] = "<p class='link'><a href='/gmap.php? &name=" . urlencode($row['name']) . " &phone=" . urlencode($row['phone']) . " &postcode=" . urlencode($row['postcode']) . "'>Map</a></p><br />"; } echo implode( '<br />', $row); } } ?> </div></div><!--end of bodywrap--> </body> </html> b.php (validates fine) <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php include($_SERVER['DOCUMENT_ROOT'].'/include/db.php'); ?> <title>Untitled Document</title> <style type="text/css"> <!-- --> </style> <link href="header.css" rel="stylesheet" type="text/css" /> <link href="a.css" rel="stylesheet" type="text/css" /> </head><body> <div id="bodywrap"> <div id="banner"> <div id="bannerleft"></div> <div id="logo"><img src="i-stevenage.png" height="100%" width="100%" alt="I-stevenage"/></div> <div id="bannerright"><div id="navbar" title=""> <div id="b1"><p class="centre"><a href="b.php">Directory</a></p></div> <div id="b2"><p class="centre"><a href="newbusiness.php">Add Your Business</a></p></div> <div id="b3"><p class="centre"><a href="contact.html">Contact Us</a></p></div> </div><!-- end of navbar--> </div><!--end of bannerright--> </div><!-- end of banner--> <div id="wrapper"> <div id="listhold"> <!-- Next Catergory --> <div class="list"><h1>Cars and Travel</h1> <?php $title ="TITLE GOES HERE"; $query = mysql_query("SELECT DISTINCT subtype FROM business WHERE type ='Cars and Travel' AND confirmed ='Yes' ORDER BY name"); echo mysql_error(); while($ntx=mysql_fetch_row($query)) $nt[] = $ntx[0]; $i = -1; foreach($nt as $value) {$i++; $FileName = str_replace(' ','_',$nt[$i]) . ".php"; $FileUsed = str_replace('_',' ',$nt[$i]); echo "<a href='" . str_replace(' ','_',$nt[$i]) . ".php?title=$title&subtype=$FileUsed'>" . ucwords(strtolower (($nt[$i]))) . "</a>" . "<br/>"; $FileHandle = fopen($FileName, 'w') or die("cant open file"); $pageContents = file_get_contents("header.php"); fwrite($FileHandle,"$pageContents");} fclose($FileHandle); ?> <h1>Legal</h1> <?php $nt = array(); $title ="TITLE GOES HERE"; $query = mysql_query("SELECT DISTINCT subtype FROM business WHERE type ='Legal' AND confirmed ='Yes' ORDER BY name"); echo mysql_error(); while($ntx=mysql_fetch_row($query)) $nt[] = $ntx[0]; $i = -1; foreach($nt as $value) {$i++; $FileName = str_replace(' ','_',$nt[$i]) . ".php"; $FileUsed = str_replace('_',' ',$nt[$i]); echo "<a href='" . str_replace(' ','_',$nt[$i]) . ".php?title=$title&subtype=$FileUsed'>" . ucwords(strtolower (($nt[$i]))) . "</a>" . "<br/>"; $FileHandle = fopen($FileName, 'w') or die("cant open file"); $pageContents = file_get_contents("header.php"); fwrite($FileHandle,"$pageContents");} fclose($FileHandle); ?> <h1>Retail</h1> <?php $nt = array(); $title ="TITLE GOES HERE"; $query = mysql_query("SELECT DISTINCT subtype FROM business WHERE type ='Retail' AND confirmed ='Yes' ORDER BY name"); echo mysql_error(); while($ntx=mysql_fetch_row($query)) $nt[] = $ntx[0]; $i = -1; foreach($nt as $value) {$i++; $FileName = str_replace(' ','_',$nt[$i]) . ".php"; $FileUsed = str_replace('_',' ',$nt[$i]); echo "<a href='" . str_replace(' ','_',$nt[$i]) . ".php?title=$title&subtype=$FileUsed'>" . ucwords(strtolower (($nt[$i]))) . "</a>" . "<br/>"; $FileHandle = fopen($FileName, 'w') or die("cant open file"); $pageContents = file_get_contents("header.php"); fwrite($FileHandle,"$pageContents");} fclose($FileHandle); ?> <h1>Hygene</h1> <?php $nt = array(); $title ="TITLE GOES HERE"; $query = mysql_query("SELECT DISTINCT subtype FROM business WHERE type ='Hygene' AND confirmed ='Yes' ORDER BY name"); echo mysql_error(); while($ntx=mysql_fetch_row($query)) $nt[] = $ntx[0]; $i = -1; foreach($nt as $value) {$i++; $FileName = str_replace(' ','_',$nt[$i]) . ".php"; $FileUsed = str_replace('_',' ',$nt[$i]); echo "<a href='" . str_replace(' ','_',$nt[$i]) . ".php?title=$title&subtype=$FileUsed'>" . ucwords(strtolower (($nt[$i]))) . "</a>" . "<br/>"; $FileHandle = fopen($FileName, 'w') or die("cant open file"); $pageContents = file_get_contents("header.php"); fwrite($FileHandle,"$pageContents");} fclose($FileHandle); ?> <h1>Refuse</h1> <?php $nt = array(); $title ="TITLE GOES HERE"; $query = mysql_query("SELECT DISTINCT subtype FROM business WHERE type ='Refuse' AND confirmed ='Yes' ORDER BY name"); echo mysql_error(); while($ntx=mysql_fetch_row($query)) $nt[] = $ntx[0]; $i = -1; foreach($nt as $value) {$i++; $FileName = str_replace(' ','_',$nt[$i]) . ".php"; $FileUsed = str_replace('_',' ',$nt[$i]); echo "<a href='" . str_replace(' ','_',$nt[$i]) . ".php?title=$title&subtype=$FileUsed'>" . ucwords(strtolower (($nt[$i]))) . "</a>" . "<br/>"; $FileHandle = fopen($FileName, 'w') or die("cant open file"); $pageContents = file_get_contents("header.php"); fwrite($FileHandle,"$pageContents");} fclose($FileHandle); ?> </div><!--end of list --> <div class="list"><h1>Skilled Trades</h1> <?php $nt = array(); $title ="TITLE GOES HERE"; $query = mysql_query("SELECT DISTINCT subtype FROM business WHERE type ='Skilled Trades' AND confirmed ='Yes' ORDER BY subtype"); echo mysql_error(); while($ntx=mysql_fetch_row($query)) $nt[] = $ntx[0]; $i = -1; foreach ($nt as $value) {$i++; $FileName = str_replace(' ','_',$nt[$i]) . ".php"; $FileUsed = str_replace('_',' ',$nt[$i]); echo "<a href='" . str_replace(' ','_',$nt[$i]) . ".php?title=$title&subtype=$FileUsed'>" . ucwords(strtolower (($nt[$i]))) . "</a>" . "<br/>"; $FileHandle = fopen($FileName, 'w') or die("cant open file"); $pageContents = file_get_contents("header.php"); fwrite($FileHandle,"$pageContents");} fclose($FileHandle); ?> </div> <!--end of list--> <div class="list"> <h1>Care</h1> <?php $nt = array(); $title ="TITLE GOES HERE"; $query = mysql_query("SELECT DISTINCT subtype FROM business WHERE type ='Care' AND confirmed ='Yes' ORDER BY subtype"); echo mysql_error(); while($ntx=mysql_fetch_row($query)) $nt[] = $ntx[0]; $i = -1; foreach ($nt as $value) {$i++; $FileName = str_replace(' ','_',$nt[$i]) . ".php"; $FileUsed = str_replace('_',' ',$nt[$i]); echo "<a href='" . str_replace(' ','_',$nt[$i]) . ".php?title=$title&subtype=$FileUsed'>" . ucwords(strtolower (($nt[$i]))) . "</a>" . "<br/>"; $FileHandle = fopen($FileName, 'w') or die("cant open file"); $pageContents = file_get_contents("header.php"); fwrite($FileHandle,"$pageContents");} fclose($FileHandle); ?> <h1>Education</h1> <?php $nt = array(); $title ="TITLE GOES HERE"; $query = mysql_query("SELECT DISTINCT subtype FROM business WHERE type ='education' AND confirmed ='Yes' ORDER BY subtype"); echo mysql_error(); while($ntx=mysql_fetch_row($query)) $nt[] = $ntx[0]; $i = -1; foreach ($nt as $value) {$i++; $FileName = str_replace(' ','_',$nt[$i]) . ".php"; $FileUsed = str_replace('_',' ',$nt[$i]); echo "<a href='" . str_replace(' ','_',$nt[$i]) . ".php?title=$title&subtype=$FileUsed'>" . ucwords(strtolower (($nt[$i]))) . "</a>" . "<br/>"; $FileHandle = fopen($FileName, 'w') or die("cant open file"); $pageContents = file_get_contents("header.php"); fwrite($FileHandle,"$pageContents");} fclose($FileHandle); ?> <h1>Financial</h1> <?php $nt = array(); $title ="TITLE GOES HERE"; $query = mysql_query("SELECT DISTINCT subtype FROM business WHERE type ='financial' AND confirmed ='Yes' ORDER BY subtype"); echo mysql_error(); while($ntx=mysql_fetch_row($query)) $nt[] = $ntx[0]; $i = -1; foreach ($nt as $value) {$i++; $FileName = str_replace(' ','_',$nt[$i]) . ".php"; $FileUsed = str_replace('_',' ',$nt[$i]); echo "<a href='" . str_replace(' ','_',$nt[$i]) . ".php?title=$title&subtype=$FileUsed'>" . ucwords(strtolower (($nt[$i]))) . "</a>" . "<br/>"; $FileHandle = fopen($FileName, 'w') or die("cant open file"); $pageContents = file_get_contents("header.php"); fwrite($FileHandle,"$pageContents");} fclose($FileHandle); ?> <h1>Home and Garden</h1> <?php $nt = array(); $title ="TITLE GOES HERE"; $query = mysql_query("SELECT DISTINCT subtype FROM business WHERE type ='home and garden' AND confirmed ='Yes' ORDER BY subtype"); echo mysql_error(); while($ntx=mysql_fetch_row($query)) $nt[] = $ntx[0]; $i = -1; foreach ($nt as $value) {$i++; $FileName = str_replace(' ','_',$nt[$i]) . ".php"; $FileUsed = str_replace('_',' ',$nt[$i]); echo "<a href='" . str_replace(' ','_',$nt[$i]) . ".php?title=$title&subtype=$FileUsed'>" . ucwords(strtolower (($nt[$i]))) . "</a>" . "<br/>"; $FileHandle = fopen($FileName, 'w') or die("cant open file"); $pageContents = file_get_contents("header.php"); fwrite($FileHandle,"$pageContents");} fclose($FileHandle); ?> <h1>Wellbeing</h1> <?php $nt = array(); $title ="TITLE GOES HERE"; $query = mysql_query("SELECT DISTINCT subtype FROM business WHERE type ='Wellbeing' AND confirmed ='Yes' ORDER BY subtype"); echo mysql_error(); while($ntx=mysql_fetch_row($query)) $nt[] = $ntx[0]; $i = -1; foreach ($nt as $value) {$i++; $FileName = str_replace(' ','_',$nt[$i]) . ".php"; $FileUsed = str_replace('_',' ',$nt[$i]); echo "<a href='" . str_replace(' ','_',$nt[$i]) . ".php?title=$title&subtype=$FileUsed'>" . ucwords(strtolower (($nt[$i]))) . "</a>" . "<br/>"; $FileHandle = fopen($FileName, 'w') or die("cant open file"); $pageContents = file_get_contents("header.php"); fwrite($FileHandle,"$pageContents");} fclose($FileHandle); ?> </div><!--end of list--> </div></div> <div id="clear"></div> </div><!--end of list hold--> </body> </html> Quote Link to comment Share on other sites More sharing options...
Alfa9 Posted June 27, 2011 Share Posted June 27, 2011 Well I don't thing that the error comes from the doctype ! try the html validator and have it correct your html automaticly http://validator.w3.org/#validate_by_uri+with_options Quote Link to comment Share on other sites More sharing options...
manzanita Posted June 27, 2011 Share Posted June 27, 2011 check ur html from a quick view.. u have an extra </style>...... after title Quote Link to comment 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.