Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2005
    Posts
    365
    Thanks
    7
    Thanked 1 Time in 1 Post

    Question PHP & xHTML code validation

    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...
    PHP 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>
    Last edited by Uzair; 03-27-2007 at 01:42 PM.

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    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

  • #3
    Regular Coder
    Join Date
    Aug 2005
    Posts
    365
    Thanks
    7
    Thanked 1 Time in 1 Post
    okie, Thanks a lot.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •