Jump to content

Recommended Posts

echo will not print out a value. I do the simple string " " and it doesn't even do that. It's just blank in my browser. I use netbeans and firefox and chrome. Any idea as to what I'm doing wrong? Simple code snippet:

 

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

<title>PHP Testing</title>

</head>

<body>

<?php

echo "print me";

?>

</body>

</html>

 

Thanks for any future help.

Link to comment
https://forums.phpfreaks.com/topic/253709-echo-not-working/
Share on other sites

Most likely cause:  You do not have PHP installed and running properly.

 

 

Open the page in your browser and view-source.  If you can see your <?php ?> tags and the code between them, then your PHP is not setup properly and your pages are not being executed.

 

Link to comment
https://forums.phpfreaks.com/topic/253709-echo-not-working/#findComment-1300612
Share on other sites

Do you have a web server that supports PHP? as the <?php ?> will just been seen as a XML entity and not render any of the contents in the browser. Look at the source of the page and if the PHP is still embedded then your web server doesn't support PHP.

 

Also, are you just trying to open the .php file in a browser if so this also won't work as the PHP files need to go through the PHP Binary to be compiled on the fly.

Link to comment
https://forums.phpfreaks.com/topic/253709-echo-not-working/#findComment-1300616
Share on other sites

I suppose I should have clarified: Everything else on the Site is in .php.  Everything else works fine.  :)

 

This is exactly the contents of the file, which is named test.php

<?php

echo "<a href='test.php?v4=".$v4."> Places</a>";

echo "<a href='test.php?v4=$v4'>Places</a>";

echo "<a href='test.php?v4=Utah'>Places</a>";

?>

 

Thanks!

Kyle

Link to comment
https://forums.phpfreaks.com/topic/253709-echo-not-working/#findComment-1300619
Share on other sites

I suppose I should have clarified: Everything else on the Site is in .php.  Everything else works fine.  :)

 

This is exactly the contents of the file, which is named test.php

<?php

echo "<a href='test.php?v4=".$v4."> Places</a>";

echo "<a href='test.php?v4=$v4'>Places</a>";

echo "<a href='test.php?v4=Utah'>Places</a>";

?>

 

Thanks!

Kyle

 

What cant you display them either? With double quotes, you do not need any ' around your link:

echo "<a href=test.php?v4=Utah>Places</a>";

Link to comment
https://forums.phpfreaks.com/topic/253709-echo-not-working/#findComment-1300624
Share on other sites

Wow.  Thank you for all these fast replies!

 

AGuyWithAthing: I'm not sure if it supports it or not.  How would I find this out?  And I tried both from the actual file and through pushing the run button.

 

Mavent:  Sorry, I'm not sure what you mean.

 

Are you using a host service like godaddy or something. Or are you using a localhost, i.e, YOU installed php on your computer. If you using neither, then you will not see any php.

Link to comment
https://forums.phpfreaks.com/topic/253709-echo-not-working/#findComment-1300630
Share on other sites

Usually a quick way to test if it's working is to put a php info file in the root of your webserver.

 

If you're using xampp for windows the dir is usually C:\Program Files\xammp\htdocs or something along those lines ain't used XAMPP in years. Make a file like phpinfo.php (be sure that the extension is PHP enable show file extensions in your folder settings) and in that file add the following:

 

<?php

phpinfo();

 

Then go to http://localhost/phpinfo.php and see if you get a page similar to : http://www.n3tw0rk.co.uk/info.php

Link to comment
https://forums.phpfreaks.com/topic/253709-echo-not-working/#findComment-1300644
Share on other sites

I installed xampp and had to put my projects in the htdocs folder and change a few settings and it worked.  A co-worker helped with the final touches of this problem but I thank you all for your helpful and quick replies.  Back to work for me!!  haha  Thank you.

Link to comment
https://forums.phpfreaks.com/topic/253709-echo-not-working/#findComment-1301194
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.