Hey, I have a question that has been confusing me for some time now...
we all know how PHP works:
Client <=> SERVER <=> PHP ENGINE
suppose we want to provide an error message in a php document when a user enters an incorrect password:
if($_GET["password"] != "apple") {
echo "<div style=\"height:120px; border: 1px solid black\">Sorry you entered the wrong password</div>";
}
Ok so in this example, PHP will generate the error html code needed if the password is wrong, but I have seen some developers already integrate the error code within the html page but set the <div> display to 'none'. They then get php to write onto the end of the <div> tag to set the display to 'block'.
Think of this in a larger scale, thousands of users, lots of error messages to print... is the php version (not putting the error message as default in the html) more bandwidth conserving because the output is processed server side and then delivered ... as opposed to sending the error messages in the html file?
🙂