Hi there, i'm running in to a weird little problem.
I'm using XAMPPlite and wrote a username/password php script
When I click login on my test page using internet explorer it shows the typed code first. Then after I hit refresh and click on retry it will show the actual php page. I can't for the life of me figure out why it won't show the php page when first clicking on login.
Does anyone have a clue on why this is happening. Let me know if you need any more information. Thanks a lot!
akphidelt
PHP Code only works after refresh?
Moderator: General Moderators
Re: PHP Code only works after refresh?
Hard to say without seeing your code. If you post it, please enclose it in [syntax=php][/syntax] BBCode tags.
Re: PHP Code only works after refresh?
pretty much any code in the php syntax for example... a simple code like this
When I open up this code which is saved as test.php in Internet Explorer, it will just show the code as written above. Then I refresh, click on retry, and then the code shows up blank.
Any ideas?
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<?php
echo "do you work?";
?>
</html>
Any ideas?
Re: PHP Code only works after refresh?
My first thought would be the header; since I don't use the XHTML Doctype header, I'm unfamiliar with whether it has any little quirks, but it would be extremely easy to rule that out, just by omitting the header and seeing if it makes any difference in the behavior.akphidelt wrote:pretty much any code in the php syntax for example... a simple code like this
When I open up this code which is saved as test.php in Internet Explorer, it will just show the code as written above. Then I refresh, click on retry, and then the code shows up blank.Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <?php echo "do you work?"; ?> </html>
Any ideas?
Beyond that, it sounds like your Apache is not configured properly. I can't explain why it would work the second time, but it surely must be that, since the only way it could send raw php code to the browser is if it is is not preprocessing it.
Re: PHP Code only works after refresh?
You are missing body tags as well.