0

I have been trying to teach myself PHP. I installed PHP with the install for AppServ on Windows(just reference info). When I tried to see if I could get a proper output I was having trouble. This is what I used that showed the right results, but according to all the references I have seen the syntax is wrong.

<HTML>

<HEAD>
<TITLE> MY FIRST PHP PAGE </TITLE>
</HEAD>

<BODY
<?php echo?> "Hello World!" <br> "Hello World"
<?php print?><br> "Hello Indiana!"
</BODY>

</HTML>

If I enter this:

<HTML>

<HEAD>
<TITLE> MY FIRST PHP PAGE </TITLE>
</HEAD>

<BODY
<?php echo "Hello World!" <br> "Hello World"?>
<?php print<br> "Hello Indiana!" ?>
</BODY>

</HTML>

I get this as an outcome:
"Hello World"?> "Hello Indiana!"?>

Can anyone help me understanding why I am having this problem.

4
Contributors
10
Replies
11
Views
7 Years
Discussion Span
Last Post by Xufyan
0
<HTML>

<HEAD>
<TITLE> MY FIRST PHP PAGE </TITLE>
</HEAD>

<BODY
<?php 
	echo "Hello World! <br/> Hello World";
?>
<?php print "<br/>Hello Indiana!" ?>
</BODY>

</HTML>

you can directly use the <html> commands within echo and print. Above shows you the correct output.

Even your syntax is not proper other texts are recognised by php.

0

This was my output after making the changes you suggested. I even copied and pasted each line after the number to make sure that I had it correct.

"Hello World"; ?>

It doesn't even shoe the "I love Indiana" at all.

0

you are running your file with localhost with the file extension of php right? If yes the above will not be the output. I had tested here.

0

Yes, I run it out of Notepad++ and the file is save with the .php. I'm still getting the wrong results. Could there be anything else that could cause this?

0
<HTML>

<HEAD>
<TITLE> MY FIRST PHP PAGE </TITLE>
</HEAD>

<BODY
<?php echo "Hello World<br>Hello World
Hello Indiana!"; ?>
</BODY>

</HTML>

Edited by vaultdweller123: n/a

0

With that code it only output one Hello World,the rest looks good.
But the ; ?> at the end is still.

0

make it even more simple,

<HTML>
<HEAD>
<TITLE> MY FIRST PHP PAGE </TITLE>
</HEAD>
<BODY>
<?php 
        echo "Hello World!";
	echo "<br />"; 
	echo "Hello World";
	echo "<br />"; 
	echo "Hello Indiana";
?>
</BODY>
</HTML>

OR

<HTML>

<HEAD>
<TITLE> MY FIRST PHP PAGE </TITLE>
</HEAD>
<BODY>
<?php echo "Hello World!"."<br>". "Hello World"?>
<?php print "<br>". "Hello Indiana!" ?>
</BODY>
</HTML>

Edited by Xufyan: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.