Page 1 of 1
echo doesn't work
Posted: Thu May 22, 2008 9:29 pm
by junjustkim
hi to all
I am newbie with php. I am using cs3 dreamweber and xampp as my server localhost. Inside dreamweber I created index.php and save it in xampp/localhost/test1. The problem is when I run the code there is no any result in my browser. I am using mozilla firefox. Actually I am following step by step with the tutorial. I test my code even using variable and output the result using echo but it doesn't work. I don't know if there is a problem with my xampp or dreamweber. Please help me I am very interested in web development.
Thanks in advance
Code: Select all
<html>
<body>
<?php
echo "Hello World";
?>
</body>
</html>
Re: echo doesn't work
Posted: Thu May 22, 2008 10:14 pm
by califdon
junjustkim wrote:
hi to all
I am newbie with php. I am using cs3 dreamweber and xampp as my server localhost. Inside dreamweber I created index.php and save it in xampp/localhost/test1. The problem is when I run the code there is no any result in my browser. I am using mozilla firefox. Actually I am following step by step with the tutorial. I test my code even using variable and output the result using echo but it doesn't work. I don't know if there is a problem with my xampp or dreamweber. Please help me I am very interested in web development.
Thanks in advance
Code: Select all
<html>
<body>
<?php
echo "Hello World";
?>
</body>
</html>
Did you name your file just
test1? You must give it a file extension of
.php in order for Apache web server to recognize that it needs to send it to PHP for preprocessing.
Re: echo doesn't work
Posted: Thu May 22, 2008 10:52 pm
by junjustkim
thanks for your immediate replied. test1 is my folder but the name is index.php
My folder structure is like this:
xampp/localhost/test1/index.php
on my browser I was type localhost/test1/index.php
the browser displayed but no result appeared but if I put another string using <p> hello world <p> it was displayed but the one using echo doesn't
Thanks
Re: echo doesn't work
Posted: Fri May 23, 2008 12:33 am
by mhonnphp
junjustkim wrote:
thanks for your immediate replied. test1 is my folder but the name is index.php
My folder structure is like this:
xampp/localhost/test1/index.php
on my browser I was type localhost/test1/index.php
the browser displayed but no result appeared but if I put another string using <p> hello world <p> it was displayed but the one using echo doesn't
Thanks
hmm... maybe you type your codes at the DESIGN VIEW!?
switch to CODE VIEW.
CS3
View MENU -> CODE
type :
<?php
echo "HELLO WORLD";
?>
then save with the extension name .php
ex. sample.php
then try to view your page again.
Re: echo doesn't work
Posted: Fri May 23, 2008 4:59 am
by timsewell
Also, and I presume this is common to all XAMMP installations, I believe files need to be in the directory \htdocs, which is the web root, to be viewable in a browser through the
http://localhost/ domain.
Re: echo doesn't work
Posted: Fri May 23, 2008 5:07 am
by panic!
when you view the page, what happens? do you literally see
'<?php
echo "Hello World";
?>'
In the browser? if so you need to change where you see < into < and > to > in your source and in future develop in code mode, maybe find a better environment for developing your code than dreamweaver.
if not, try viewing the source and paste us what you see.
Re: echo doesn't work
Posted: Fri May 23, 2008 8:09 am
by junjustkim
Thank you to all of you, actually I already solved my problem a while ago. The problem is to my browser mozilla firefox because I tried to open it in IE and it worked it out. I don't know if i have to modify the settings of my firefox.
Hi panic! what would you suggest best environment for developing web using php.
Again thank you so much to all of your best effort.
tirso
Re: echo doesn't work
Posted: Tue May 27, 2008 7:08 am
by panic!
Hi,
I personally use Coda for Mac, some other people I work with use TextMate.
I don't know about Windows development apps. Maybe you could make a thread asking for opinions.
Re: echo doesn't work
Posted: Thu May 29, 2008 9:38 am
by junjustkim
Thanks for your replied