...

View Full Version : PHP & xHTML code validation



Uzair
03-27-2007, 02:38 PM
When I use <?PHP something ?> in my xHTML document, W3C dont validate it as a valid xHTML document. What is the right way to right PHP in xHTML documents? Here is my sample PHP/xHTML code...



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?PHP include ("config.php");
$rowsPerPage = 2;
$pageNum = 1;
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>fhfghfghgfhgf</title>
<link rel="stylesheet" type="text/css" href="global.css" />
<script language="javascript" type="text/javascript" src="genreload.js" ></script>
</head>
<body leftmargin="0" topmargin="35">
<table width="460" border="0" cellpadding="0" cellspacing="0">

<tr>
<td width="198" height="156" align="left" valign="middle">
<a href="http://www.furnishersworld.co.uk" onmouseover="imgon('<?PHP echo $row['image_name']; ?>')" onmouseout="imgoff('<?PHP echo $row['image_name']; ?>')" target="_blank">
<img src="images/<?PHP echo $row['image']; ?>" name="<?PHP echo $row['image_name']; ?>" alt="Portfolio - Freelance Web Designer - Muhammad Uzair Usman" width="198" height="156" /></a></td>
<td width="262" align="left" valign="default" class="tdprt">
<strong>Client:</strong>
<?PHP echo $row['client']; ?><br />
<strong>Category:</strong>
<?PHP echo $row['cat_id']; ?><br />
<strong>Requirements:</strong>
<?php do{ if(!empty($req_rows)){
echo $req_rows['req_name'].", ";
}
}while($req_rows=mysql_fetch_array($req_results));?><br />
<strong>Technology:</strong>
<?php do{ if(!empty($tech_rows)){
echo $tech_rows['tech_name'].", ";
}
}while($tech_rows=mysql_fetch_array($tech_results));?><br />
<strong>Complition Time:</strong>
<?PHP echo $row['time']; ?><br />
<span class="link"><a href="http://www.<?PHP echo $row['url']; ?>" onmouseover="imgon('<?PHP echo $row['image_name']; ?>')" onmouseout="imgoff('<?PHP echo $row['image_name']; ?>')" target="_blank">Visit Website</a></span>
</td>
</tr>
<tr>
<td colspan="2" height="24"><hr /></td>
<?PHP }?>
</tr>
<tr>
<td colspan="2" align="center" class="pagination">
</td>
</tr>
</table>
</body>
</html>

Nightfire
03-27-2007, 02:46 PM
You can't send it as a file to the validator, you have to put in a url. The PHP needs to be parsed by the server, otherwise you'll get the errors

Uzair
03-27-2007, 02:48 PM
okie, Thanks a lot.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum