trickyd60 Posted February 3, 2015 Share Posted February 3, 2015 I have this simple piece of html: <!DOCTYPE html><html><head> <meta charset="UTF-8"> <style> .error {color: #FF0000;} </style> <title>20 Dollar Sizzler</title></head> <body><?php echo "My first PHP script!"; ?></body></html> the validator doesn't like the <?php tag I copied that directly from the W3 tutorial What's going wrong please? regards, Ricky Link to comment Share on other sites More sharing options...
Ingolme Posted February 3, 2015 Share Posted February 3, 2015 The PHP needs to be parsed on a server that supports PHP. The code that arrives to the browser will not have <?php ?> tags in it. Link to comment Share on other sites More sharing options...
trickyd60 Posted February 3, 2015 Author Share Posted February 3, 2015 Thanks. The web hosting has php 5.6 I'm not sure of all the options they have in there because it's a large list of various things Link to comment Share on other sites More sharing options...
Ingolme Posted February 3, 2015 Share Posted February 3, 2015 If the file is saved with a .php extension then the PHP will be parsed and executed. When trying to validate the page, don't copy and paste the code, give the URL of the page to the validator. Link to comment Share on other sites More sharing options...
trickyd60 Posted February 3, 2015 Author Share Posted February 3, 2015 (edited) it's in a html file - does it have to be a php file? Edited February 3, 2015 by trickyd60 Link to comment Share on other sites More sharing options...
trickyd60 Posted February 3, 2015 Author Share Posted February 3, 2015 (edited) also I did give the URL to the validator - I typed wrongly above Edited February 3, 2015 by trickyd60 Link to comment Share on other sites More sharing options...
trickyd60 Posted February 3, 2015 Author Share Posted February 3, 2015 aren't we allowed to run php in a html file inline? I would like to do processing of a form as per the W3 Tutorial on PHP I'm really confused Link to comment Share on other sites More sharing options...
Ingolme Posted February 3, 2015 Share Posted February 3, 2015 PHP will not work if the file does not have a .php extension. Link to comment Share on other sites More sharing options...
JamesB Posted February 5, 2015 Share Posted February 5, 2015 You still can use the html inline with php, but as Ingolme said you need the .php extension. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now