W3 Validation Error

Hi All

I am new to PHP and this forum. I have produced a basic e-commerce prototype using php for an assignment. It all works as expected. I am just doing some finishing touches and checking all pages through W3 validation. I have correct all errors and all bugs expect one and I am a bit lost with it so wondering if anyone can help me spot what I have done wrong.
I have pasted the PHP code and the output’d code below.
The error I get is:

end tag for "table" which is not finished
Apollo Expeditions to the Moon Discover the exciting backstage story of the NASAs Apollo program and lunar landing with this volume of essays by the programs participants engineers, administrators, and astronauts describing the unprecedented challenges associated with putting men on the Moon. Written in direct, jargon free language, this enthralling exploration story features nearly a hundred black and white illustrations as well as more than 160 dazzling color photographs. £7.99 View Nuclear and Particle Physics An accessible introduction to nuclear and particle physics with equal coverage of both topics, this text covers all the standard topics in particle and nuclear physics thoroughly and provides a few extras, including chapters on experimental methods, applications of nuclear physics including fission, fusion and biomedical applications and unsolved problems for the future. £38.99 View Go Back[/code]

The only suggestion I can off is to remove the white space.

Change:

[php] echo “

View”; [/php]

To:

[php] echo “

View”;[/php]

I don’t see anything wrong that will cause that error, obviously you didn’t show the full HTML output just a snippet.

Hi Topcoder

Thank you for the suggestion. Will give that a go, really frustrating as every page passes validation apart from this one, with this table. Grrr lol I will report back :slight_smile:

Why i the world are you echoing HTML?

[php]


<?php
while ($row = mysqli_fetch_object) {
?>







<?php } ?>
<?php echo $row->ProductName; ?> <?php echo $row->ProductDescription; ?> <?php echo $currency . $row->ProductPrice; ?> View
[/php]

you can also short tag … <?= ?> instead of <?php echo "content echo"; ?> inside the HTML tags.

Hi All

Thank you all for your help on this one, and thank you Strider64 for the great example. A much cleaner approach to mine.
I also worked out why my approach was failing W3 Validation, it was because in the structure and doctype I am using it was looking for at least one

tag. As soon as I added this it passed the validation.

But will look at reviewing the code as you have suggested.

Thanks again

Sponsor our Newsletter | Privacy Policy | Terms of Service