1

I am running XAMPP in order to use PHP on my local computer. I put all of my scripts inside of the htdocs folder (the default location). Everything used to work great until recently. For example, if I click on an HTML file in htdocs, the file opens up in a browser(like it should). But, if I click submit on a form with an action set to "some-script.php" It goes to the php page and displays the php code. Now, if I type into my browser "localhost/some-html.html" then it works? Why is that? What could I be doing wrong??

2
  • your Apache are not processing your PHP. Can be a lot of things. You recently installed XAMPP ? That's your OS ? Commented Jul 27, 2012 at 0:29
  • I have it installed for a while. I can get it to work if I hard type it into my browser. Windows 7 Commented Jul 27, 2012 at 0:34

2 Answers 2

5

When you access it by typing "localhost/some-html.html" into the address bar you use XAMPP's server and PHP engine to access the page, when you simply double click the file in the folder you are just opening the file with the default program (which happens to be your browser)

Sign up to request clarification or add additional context in comments.

1 Comment

XAMPP's PHP engine is what actually runs the php code before sending the result to the browser
0

define a base url variable like $baseurl = "http://localhost/foldername/" and use this variable in your action like action = "example.php".

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.