up vote 0 down vote favorite
share [g+] share [fb]

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?

link|improve this question

1  
How do you open the PHP file? – str Sep 4 '11 at 20:03
1  
do you have it saved as a php file? are you running it via a php compatible server? (apache etc...) – Petr Marek Sep 4 '11 at 20:03
1  
how do you open the file? – Andreas Henning Sep 4 '11 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. – DLA Sep 4 '11 at 20:05
if you want to test it locally, you can set up XAMPP to create a functional webserver on your localhost. ;) – Andreas Henning Sep 4 '11 at 20:13
feedback

2 Answers

up vote 0 down vote accepted

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

link|improve this answer
oh, right. that could make sense. i was just trying to test it locally. – DLA Sep 4 '11 at 20:05
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.