New to php and need some help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mfbrowne
Forum Newbie
Posts: 16
Joined: Tue May 02, 2006 11:45 am

New to php and need some help

Post by mfbrowne »

hawleyjr | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hello, I am new to php and I am just doing some basic testing to get my feet wet and it seems I am having som troble already.

If I do this in a html document

Code: Select all

<SCRIPT LANGUAGE='PHP'> echo '<p> This is a Test </p>' ; </SCRIPT>
or

Code: Select all

<?php
echo '<p> This is a Test </p>' ;
?>
I would have expected the "This is a Test" to show up on the document. But it does not and I have no idea what to look for on why this would happen.

Can anyone help me in trying to understand why this does not work.

Thanks

Mike


hawleyjr | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]2.[/b] Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.[/quote]
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Both should work. You also need to make sure the name of the file containing this script ends with a ".php" extension. HTML documents are not parsed by PHP by default in most configurations (though the webserver an be configured to do that) -- only those with the PHP extension.
(#10850)
mfbrowne
Forum Newbie
Posts: 16
Joined: Tue May 02, 2006 11:45 am

Post by mfbrowne »

Well it seems that I can't get this to work in either format. Is there something I should look for that would help me determine why it does not work.
mfbrowne
Forum Newbie
Posts: 16
Joined: Tue May 02, 2006 11:45 am

Post by mfbrowne »

Ok I figured it out, it was just me being rather dumb. Thanks for the help.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Oh yeah and btw don't use that one:

Code: Select all

<SCRIPT LANGUAGE='PHP'> echo '<p> This is a Test </p>' ; </SCRIPT>
Its depreciated and not very good anyway.
User avatar
php3ch0
Forum Contributor
Posts: 212
Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK

Post by php3ch0 »

Where are you testing your files?
Post Reply