Solved

PHP Progress bar breaks HTML>

Posted on 2012-03-13
4
380 Views
Last Modified: 2012-03-18
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.
0
Comment
Question by:steva
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37718059
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.
0
 

Author Comment

by:steva
ID: 37725298
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
0
 
LVL 34

Accepted Solution

by:
Slick812 earned 500 total points
ID: 37726236
greetings Steve,  I have noticed, that as Newer "Versions" of DHTML and CSS come out, sometimes things (usually the NEW stuff)  you do in DHTML and CSS work in one browser and not another. So to try and have working code I try and follow the "Rules", if I can, but the Rules are different in different browsers, not always  following the  w3schools  idea of what a Rule is, or what any other browser has its rules as.  Just because  w3schools  or anyone else says that DHTML works a certain way, does not mean that the Browser developers will use that idea.  I would say - If the code above works in all of your tested browsers, then don't worry about it.
0
 

Author Comment

by:steva
ID: 37735808
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.)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How do I Check for duplicate entries in mysql 15 47
Ajax success not firing alert 6 36
Joomla Editing 3 18
Developers / Staff Setup 10 34
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question