I'm a complete novice to PHP so please excuse what is probably a very simple question.
echo("Fred");
works correctly in a .PHP file but not in an HTM, e.g.
My name is <?php echo(" Fred "); ?> Bloggs
only displays My name is Bloggs.
According to http://php.about.com/od/advancedphp/p/html_php.htm it says I need to add
AddType application/x-httpd-php .html
Or
AddType application/x-httpd-php .htm
to my .htaccess file.
If I do that and then open the HTML page the browser (Opera) comes up with a pop-up to download the html file.
What should I be doing?
Bob
PHP code in HTM not being executed?
Moderator: General Moderators
-
Bob Kellock
- Forum Newbie
- Posts: 10
- Joined: Fri Oct 30, 2009 10:57 am
- Location: Wiltshire, UK
- akuji36
- Forum Contributor
- Posts: 190
- Joined: Tue Oct 14, 2008 9:53 am
- Location: Hartford, Connecticut
Re: PHP code in HTM not being executed?
Hello
In order for php engine to recognize and process embedded php in html
form the entire file must be saved in php format ex
example.php
in example php file
you may write your html form
and include php.
thanks
Rod
In order for php engine to recognize and process embedded php in html
form the entire file must be saved in php format ex
example.php
in example php file
you may write your html form
and include php.
thanks
Rod
-
Bob Kellock
- Forum Newbie
- Posts: 10
- Joined: Fri Oct 30, 2009 10:57 am
- Location: Wiltshire, UK
Re: PHP code in HTM not being executed?
Thanks, Rod.
I'd tried that but it simply puts up the message "No input file specified".
What sort of input file is wanted?
Bob
I'd tried that but it simply puts up the message "No input file specified".
What sort of input file is wanted?
Bob
- akuji36
- Forum Contributor
- Posts: 190
- Joined: Tue Oct 14, 2008 9:53 am
- Location: Hartford, Connecticut
Re: PHP code in HTM not being executed?
Here's an example of php embedded in html form.
Note in this case all code is on one page
(sometimes the user is directed to another page which processes all the php code).
http://www.ntchosting.com/php/php-in-html.html
thanks
Rod
Note in this case all code is on one page
(sometimes the user is directed to another page which processes all the php code).
http://www.ntchosting.com/php/php-in-html.html
thanks
Rod