Page 1 of 1
PHP Code only works after refresh?
Posted: Mon Feb 18, 2008 6:37 pm
by akphidelt
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
Re: PHP Code only works after refresh?
Posted: Mon Feb 18, 2008 6:42 pm
by califdon
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?
Posted: Mon Feb 18, 2008 7:08 pm
by akphidelt
pretty much any code in the php syntax for example... a simple code like this
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>
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?
Re: PHP Code only works after refresh?
Posted: Mon Feb 18, 2008 7:20 pm
by califdon
akphidelt wrote:pretty much any code in the php syntax for example... a simple code like this
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>
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?
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.
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?
Posted: Mon Feb 18, 2008 7:52 pm
by Benjamin
You are missing body tags as well.