Validation Help

Can anyone explain why I am getting these validation errors?

http://relayweather.com/wxclientraw.php

Click “HTML 4.01” icon at the bottom on the footer to run the validation.

Thanks
Michael

It’s all in the generated HTML of the script. It is doing two things:

  1. the attributes inside a tag are delimited with a single-quote ’ , not a double-quote " as required by XHTML 1.0-Transitional (which is the format of the template set).
  2. there is a missing before a continuing the series.

So:

...

Should read

Field # Label Type/Unit Value
0
[b][/b] ...

It would also be good to emit a \n (new line) after each

so it would be easier to read :slight_smile:

Best regards,
Ken

Field # Label Type/Unit Value
0

Hi Ken,

Thanks for assisting!
When adding the

, I get a parse error:

Parse error: syntax error, unexpected T_LNUMBER, expecting ‘,’ or ‘;’ in /virtual/users/e15814-16727/web/clientraw.php on line 30
(line 30 is the line with the table border)

Here is the exact coding that creates the table:

<?php
echo "<table border="0"><tr><td>".$field."</td><td>Label</td><td>".$type."</td><td>".$value."</td></tr>";
echo $clientraw_content;
echo "</table>";
?>



<?php echo '<a href="#top">'.$gotop.'</a>'; ?>

Unless the specification has changed, that is not correct. The requirement that I’ve seen simply says that the attributes must be contained with quotes… single or double as long as they are matched.

I use it both ways with no validation errors for XHTML 1.0 (traditional|strict) and XHTML 1.1 strict. I don’t use Frameset.

In XHTML, all attribute values must be enclosed by quotes; either single (') or double (") quotes may be used.

Out of habit, I would write the above in an easier to see format when I have a problem
seeing what the issues are…

<?php 
...

echo '
    <table border="0">
        <tr>
            <td>' . 
                $field . '
            </td>
            <td>
                Lable
            </td>
            <td>' . 
                $type . '
            </td>
            <td>' . 
                $value . '
            </td>
        </tr>
    </table>' .
    $clientraw_content . '
    
 

    <a href="#top"> ' . $gotop . '
    </a>';

I’m guessing that the clientraw_content is supposed to be outside the table ?? If not, put it inside the table between some 's

Kevin,

Appied your suggestion and got it down to two errors.
Code as it stands now:

<?php
echo '
    <table border="0">
        <tr>
            <td>' . 
                $field . '
            </td>
            <td>
                Lable
            </td>
            <td>' . 
                $type . '
            </td>
            <td>' . 
                $value . '
            </td>
        		<td>' .
    $clientraw_content . '
    				</td>
    		</tr>
    </table>
    
 

    <a href="#top"> ' . $gotop . '
    </a>';
?>

Not knowing the script, I’m not sure what is supposed to be in the $clientraw_content variable.

The error is pretty clear though…

<td>[color=red][b]<tr>[/b][/color]<td class='bordersleftrightfield'>0</td><td class='bordersrigh...

You can’t have a there and that would appear to be at the beginning of the $clientraw_content data.

It would appear that the variable includes other table elements, you would need to find out what those are. As Ken stated above, you might modify the script that creates the $clientraw_content so that it has line breaks in it to see it better.

You might check with the author of that script…

OK Kevin, I will keep working at it…

Appreciate your comments!

Kevin,
Got it figured out! All validates now :smiley:
Thanks for pointing me in the right direction.

Ken,
Thanks to you as well…
How do I implement the \n (new line)?

Regards,
Michael

In a <?php echo "\n"; ?> … the \n is interpreted as a ‘new-line’ when printed inside a double-quoted PHP string. It won’t work if you echo ‘\n’; … that will put ‘\n’ to the page instead of a new-line. Escape characters like \n are only interpreted in PHP inside of double-quoted strings :slight_smile:

Best regards,
Ken

Ken,

How could I implement this in the following line?

<?php
......
$clientraw_content .= "<tr><td>".$clientraw_cpt."</td><td>".$labels_clientraw[$clientraw_cpt]."</td><td>".$types_clientraw[$clientraw_cpt]."</td><td>".$data_clientraw[$clientraw_cpt].'</td></tr>';
  $clientraw_cpt++;
......
?>

Thanks,
Michael

Just change the ending of the line from

‘’;

to

“\n”;

and that will put a new-line at the end of the text.

Best regards,
Ken

Its a beautiful thing :wink:…Cheers Ken!