Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to connect to mysql with php i have done this before but this time i tested php and it wont show echo string, this is the code...I have installed php and it shows details when i type in the cmd php -version...


HTML
<pre><!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <?php echo "salut"; ?>
  </body>
</html>

When i load the page in Firefox Mozilla it is blank...


What I have tried:

1.I installed xampp
2.I checked if php is installed by cmd php -version
Posted
Updated 19-Jan-19 0:28am

1 solution

You can't just save it as an HTML file on your dev machine and open it in firefox: it needs to be opened from a server which supports PHP.

If you don't then the php code can;t be executed so you will get a blank display.
Try it:
HTML
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    This machine <?php echo "supports php"; ?>
  </body>
</html>
Will print "this machine" but nothing else.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900