0

I have a file called form.php which is just a regular html file with the addition of the following:

<form>
<input type="text" value="<?php if(!empty($_GET['type'])) {echo(htmlspecialchars($_GET['type']));} ?>" />
</form>

The problem is that when I open the file, the actual PHP code itself is displayed in the text field, instead of getting the variable 'type.' How do I solve this?

4
  • 1
    How do you open the PHP file? Commented Sep 4, 2011 at 20:03
  • 1
    do you have it saved as a php file? are you running it via a php compatible server? (apache etc...) Commented Sep 4, 2011 at 20:03
  • 1
    I just tried to run it locally in my browser. I'm now going to upload it to my website and test it. Commented Sep 4, 2011 at 20:05
  • if you want to test it locally, you can set up XAMPP to create a functional webserver on your localhost. ;) Commented Sep 4, 2011 at 20:13

2 Answers 2

0

PHP module is not loaded or not installed. Check your server's configuration

1
  • oh, right. that could make sense. i was just trying to test it locally. Commented Sep 4, 2011 at 20:05
0

You say the code is in a "regular html file", does that mean the file is, for example, "myfile.html"? If so, rename it to "myfile.php" and that should solve your problem.

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.