Avatar of steva
steva
 asked on

PHP Progress bar breaks HTML>

I just implemented the progress bar described in "PHP 5 in Practice" by White and Eisenhamer on pp198ff.  The PHP code just echoes out a <style> section followed by a some div elements in the middle of the body section. What surprises me is that it's ok to stick a <style> ,,, </style> section in the middle of the body.  This seems to work fine but w3schools says for <style> at http://www.w3schools.com/tags/tag_style.asp :

The <style> element always goes inside the head section.

I'm just wondering how PHP gets around this. To make the bar go away when it reached completion I just echoed out:

echo "
	<style>
           #barbox {
		display:none;
	   }
	  #bar {
		display:none;
 	 }
	</style>
";

Open in new window


And that worked too.

Thanks for any input.
PHP

Avatar of undefined
Last Comment
steva

8/22/2022 - Mon
Dave Baldwin

The browsers are designed to try to make things work as much as they can.  So even things that aren't exactly by the rules will often work anyway.  That doesn't mean it's a good idea.  Better if you can find a way to do it by the rules.
steva

ASKER
I'm surprised that no one has jumped in to defend  White and Eisenhamer.  Ray,  you recommended this book to me awhile ago and I think you said you even knew one of the authors and spoke highly of him.  Nothing in his defense?

Steve
ASKER CERTIFIED SOLUTION
Member_2_248744

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
steva

ASKER
Slick812,

Thanks for response.  Yes the code does work in all the tested browsers.  I was a bit surprised when IE pulled it off, but it does.

I like your answer better than Dave's, so I'll give you the  points.

(Sorry Dave.)
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck