<html>< head>< title >php test< /title >< /head >
< body>
<?php echo "hello world<P>"; ?>
< /body>< /html>

its in a e-book and it shows up in my web page as

< head> < title >php test< /title > < /head > < body> < /body>< /html>

what should i use to save .php3 or .html im confused already
what should i use word pad yahoo what im confused plz help me

Recommended Answers

All 14 Replies

you would save it as a .php file and then you will have to upload it to your server that has php running on it and what it should look like is that it will pring hello world in the body of the html doc :)

so it would show up just like
Hello world
?
that would be the same as
<html>
<head> <title> hello world </title> </head>
<body>
hello world
</body>
</html>

It should display in a browser as:

<html>< head >< title > php test< /title > < /head > 
< body > 
hello world<P>
< /body></html>

You will need to save the file with a .php extention, and in order to correctly display output you will need php installed, if you are on windows you can download precompiled binaries of apache from apache and precompiled binaries of php from
php

It doesn't really matter what editor you use, but I would suggest a plain text editor ie notepad since wordpad and word etc, can add unwanted characters.

Also as a side point you don't need to have the gaps in the html ie:

< body >

Would be better displayed as:

<body>

Also when adding code in the forum using the &#091;code&#093;&#091;/code&#093; tags makes it easier to read.

HTH

Ben

right?
im new to this

i downloaded the php thingy 5 or something and i save it as hello.php and it still dont work just another notepad and i go to save as .html and it does the same thing still

should i save as .php3 like it says i tried it to but i dont know whats rong

lillafan i tried what u said andit does the same thing and i dont know to use the program it game me to write it or what i dont even know what the thing is i downloaded but i did hope its not a hack or any thing but im still lost

lillafan i tried what u said andit does the same thing and i dont know to use the program it game me to write it or what i dont even know what the thing is i downloaded but i did hope its not a hack or any thing but im still lost

Don't worry it isn't a hack, you are just not using it in the right way, php scripts need to be parsed by the php executable in order to work correctly, there is text editors you can use that will allow you to see the output correctly:

php editor

However, the best way is to locally install apache and php so you can test it locally here is a link to a website that explains how to install, apache, php and mysql for windows:

Installation Instructions

If you follow the instructions at the site listed above you will be able to go to a webserver located on your machine by putting:

http://localhost

Into internet explorer or whatever browser you happen to be using.

HTH

Ben

well im just going to help this guy with his site and i cant get 1 thing right lol

im still confused i might just go back to html

before you try and help someone with PHP you should understand what it is for, and have an understanding of the PHP syntax. PHP is for serverside scripting unlike java wich is webside. PHP is used mainly for database accessing, storing of data and working with things that you cant normally work with in somthing static such as HTML. you could use PHP to store a list of usernames and passwords and the such.

i under stand the basics and they guy now knows i wanna help him so he got some 1 to teach me php

<html>
<head>
<title> hey world </title>
</head>
<body>
<?php print"hey";
//what up?
?>
</body>
</html>

is this right?

i under stand the basics and they guy now knows i wanna help him so he got some 1 to teach me php

<html>
<head>
<title> hey world </title>
</head>
<body>
<?php print"hey";
//what up?
?>
</body>
</html>

is this right?

Slight alteration I don't know if it makes a difference to the interpreter but for the sake of readability:

<?php print "hey";
// Have a space 
?>

woof woof

lol good puppy!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.