1

I am 15 and new to HTML and PHP so if i did something stupid, please excuse me!

I have made a website with a contact form and I made the .php file. This is my code:

<FORM METHOD="POST" ACTION="contact.php">

I click submit and it takes my to the contact.php file and it shows me the code in the browser. How do I make the php file actually work?

3
  • could you post all the code please? and what do you want to do? store in a database or email? Commented May 21, 2011 at 21:32
  • Is PHP actually supported by your server? Commented May 21, 2011 at 21:35
  • you should also check that short tags are not used, e.g <? for opening and also <?= as if its set to off your also see un-parsed code... Commented May 21, 2011 at 22:20

3 Answers 3

3

There are two suspects here.

1). You're trying to view this locally. You'll need to actually have a server with PHP installed and route things through that.

2). Your server doesn't understand PHP.


Added:

Actually a 3rd thought occurred to me:

3). Your PHP file doesn't have a PHP start marker set. Make sure the file begins with <?php (although there are some derivations of that).

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

Comments

2

Your problem is neither PHP nor HTML (much less HTML5) -- if a PHP file displays in the browser, then webserver is not set up right. However, without knowing what machine you are on , it's impossible to advise further.

Also, welcome to web programming, we are here to help. Please consider contributing to an open source project (I would recommend Drupal of course :) ).

Comments

1

Do you have installed server ? If you don't have, you can use xampp - includes apache, php, mysql and other stuff.

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.