/    Sign up×
Community /Pin to ProfileBookmark

Basic PHP problems….

I am very confused. I know basic php but for some reason i can’t get this script to display right…:

[code]
<html>
<body>
<?php
$str = “Who’s Kai Jim?”;
echo $str;
echo “<br />”;
echo $str.”<br />I don’t know!”;
?>
</body>
</html>
[/code]

i saved it as a .php and opened it in firefox on linux mint. this is the output on the browser window.

“; echo $str.”
I don’t know!”; ?>

i am so confused as to what is going wrong. I played with the script a little a but and all i can figure out is that it relies on ‘<‘ or ‘>’ but i don’t know why.

please help as this is very frustrating…

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@talmanDec 20.2010 — Looks like Firefox is opening the file directly.

PHP is parsed on the web server, you need to put the file on web server with PHP installed and point your browser at the server.
--


Leslie Liew - Web Developer
Copy linkTweet thisAlerts:
@spotted_zebraauthorDec 20.2010 — well i am uploading it to a server then opening it. Firefox is opening it from the ftp side of the server not the normal "Internet" side; does this make a difference?

EDIT:

Ok i have it working now but there is no way to open it correctly from the ftp side as i am just practicing and would rather not have it accidentally viewable to the entire public internet
Copy linkTweet thisAlerts:
@NogDogDec 20.2010 — You can install Apache and PHP on your PC and test it locally. Note that you still have to open it via HTTP, but you can do so via "localhost", e.g.: "http://localhost/file_name.php". You can download and install WAMP or XAMPP to handle the entire installation process for you. (I prefer WAMP, but it's only for Windows, whereas XAMPP will work on most popular platforms -- both are free.)
Copy linkTweet thisAlerts:
@spotted_zebraauthorDec 20.2010 — You can install Apache and PHP on your PC and test it locally. Note that you still have to open it via HTTP, but you can do so via "localhost", e.g.: "http://localhost/file_name.php". You can download and install WAMP or XAMPP to handle the entire installation process for you. (I prefer WAMP, but it's only for Windows, whereas XAMPP will work on most popular platforms -- both are free.)[/QUOTE]

i may give this a shot.

for now i have it figure out but running into more problems with my host. they don't allow their clients to create databases and tables with php and mysql.

you have to use some crappy web based software to do so. i am considering switching or setting up my own server, i have been forwarded to their software engineers twice in a week. this leads me to believe i have out grown basic hosting or i just really need to find one that does what i want it to do.
Copy linkTweet thisAlerts:
@sagarmallaDec 20.2010 — hey first learn about the client side and sever side language and their difference. after that please note that the php file need server to run so ..be sure about where to put your folder.http://www.phpfresher.com see this about where and how to run your file
×

Success!

Help @spotted_zebra spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...