Jump to content

Trouble With Echos


kreative_katt

Recommended Posts

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.

Link to comment
Share on other sites

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 by Turd
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.