kreative_katt Posted September 23, 2012 Share Posted September 23, 2012 This is a side thing I'm working on to help myself learn PHP and AJAX for a school project. Not part of the actual assignment. I got a little fed-up trying to get the project to work so decided to simply throw a 'hello world' in using php. If I understand things right, adding: <?php echo '<p>Hello world</p>'; ?> to my HTML file should have added: Hello world. Instead I get this: Hello world '; ?> I'm really not sure what would cause that unless I'm grossly misunderstanding the PHP syntax somewhere or have a typo I'm just not seeing. Any help is appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/268684-trouble-with-echos/ Share on other sites More sharing options...
Monkuar Posted September 23, 2012 Share Posted September 23, 2012 (edited) Try to save the file as a .php instead of a .html. Your server is NOT configured to run php inside html. You need to look into that. What server are you running it on? Localhost or a development? WAMP/Apache/Nginx/etc? Edited September 23, 2012 by Turd Quote Link to comment https://forums.phpfreaks.com/topic/268684-trouble-with-echos/#findComment-1380204 Share on other sites More sharing options...
darkfreaks Posted September 23, 2012 Share Posted September 23, 2012 (edited) @TURD is correct you cannot run PHP code inside of a HTML file you need to change it to .php Edited September 23, 2012 by darkfreaks Quote Link to comment https://forums.phpfreaks.com/topic/268684-trouble-with-echos/#findComment-1380205 Share on other sites More sharing options...
kreative_katt Posted September 23, 2012 Author Share Posted September 23, 2012 Ahh ok. Yeah still trying to figure all this stuff out. I'm running on localhost for the moment, set up WAMP for this project. Essentially, prof gave us some .php files that are classes with functions. We're supposed to build a 'twitter' page with a feed of five most recent tweets and input forms to post one, communicate with AJAX to update the sections and post tweets, etc. Quote Link to comment https://forums.phpfreaks.com/topic/268684-trouble-with-echos/#findComment-1380275 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.