Why is that the html code source in Chrome does not show what it should be showing when viewed from Google View Source
For example, I wrote like this
<div><?php echo "HELLO!" ?></div>
But if I view source, "Hello" does not exist even though it displayed HELLO on page!
Or if I create an input with a value inserted from PHP, it won't show the value in source even though the value is displayed on page! Even sometimes the hidden input tag is not displayed but it's STILL carrying it for the next page (I know because the next page could get the hidden variables).
UPDATE: AJAX is not used. I viewed on IE and FF and they show source as expected. Only Google Chrome didn't show as expected. I was trying to compact my code so I can provide the code online but was unable to show that behavior - something in my full code is preventing Chrome from showing variables in source. Now, I am thinking it's probably something in session_start() and a function checking for valid login. What I think is that Chrome doesn't hold that particular session and as a result, displays missing values when trying to refresh that page in "VIEW SOURCE."
ANOTHER UPDATE:
Found a way to duplicate and it confirms my theory that it is related to sessions and Chrome's inability to cache data when retreiving source code.
Try this:
<?php
session_start();
?>
<html>
<body>
<h1><?php echo "SURPRISE!" ?></h1>
<p>
</body>
</html>
Copy and paste on php file. Open it in Chrome. You should see "SURPRISE!" While it's open, go back to the file and delete "SURPRISE" and save it. Then go back to where you saw SURPRISE! page and get "VIEW SOURCE" and you'll get empty text.
Try removing, "session_start()" and you'll see that Chrome is able to "cache" SURPRISE text and will display "SURPRISE."