cybermind Posted April 22, 2015 Share Posted April 22, 2015 Hello :-)This PHP code: <html> <?php echo "<h2>PHP is Fun!</h2>"; echo "Hello world!<br>"; echo "I'm about to learn PHP!<br>"; echo "This ". "string ". "was ". "made ". "with multiple parameters."; ?> </html> outputs this: PHP is Fun!"; echo "Hello world!"; echo "I'm about to learn PHP!"; echo "This ". "string ". "was ". "made ". "with multiple parameters."; ?> And I cannot figure out why :-( Quote Link to comment Share on other sites More sharing options...
Solution xProteuSx Posted April 22, 2015 Solution Share Posted April 22, 2015 Seems like you've got this in a .htm or .html file. Try saving the file as .php, and see if the code runs properly. There are ways to make PHP code run in .html or .htm or .shtml files, by editing your .htaccess file. Quote Link to comment Share on other sites More sharing options...
cybermind Posted April 22, 2015 Author Share Posted April 22, 2015 Thank you for info :-) I will study this .htaccess thing :-) The problem was that I was just opening the index.php in my browser, it of course had to be hosted on a web server :-P Quote Link to comment Share on other sites More sharing options...
xProteuSx Posted April 22, 2015 Share Posted April 22, 2015 My .htaccess files usually contain something like this: AddHandler application/x-httpd-php5 .html .php .htm .shtml This tells the server to look for php code within those file types, and process it as php code, and not plain text. Quote Link to comment Share on other sites More sharing options...
cybermind Posted April 22, 2015 Author Share Posted April 22, 2015 Ah, cool :-) Well, that is already set up :-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.