0

So I am learning PHP from a book and I understand it is done server side. I installed wampserver and it's running. When I open my php file, it'll run the first line but the rest just displays in the browser. Here's the code:

<!DOCTYPE html>
<html>
  <head>
    <title>Bob's Auto Parts - Order Results</title>
  </head>
  <body>
    <h1>Bob's Auto Parts</h1>
    <h2>Order Results</h2> 
    <?php
    echo "<p>Order processed at ";
    echo date('H:i, jS F Y');
    echo "</p>";

    ?>  
  </body>
</html>

Here's what displays: Screen Shot

It displays the first 'echo' statement it seems. But the rest... I haven't changed any settings on the wampserver program, I just installed it and made sure all services were started up. Is there something else I need to do?

I'm using Windows 10.

  • It's most likely that none of your PHP code is being executed at all, and that the browser is just rendering the HTML component of your first line of PHP instead. Check the source code to find out. – scrowler Nov 08 '16 at 21:22
  • does your file end in .php (dot php) – Jethro Hazelhurst Nov 08 '16 at 21:24
  • None of your PHP is running. View the source of the output. – Brad Nov 08 '16 at 21:25
  • 1
    Clearly the PHP code isn't being executed at all. Sounds like a server configuration issue. The linked duplicate question will have lots of information. – David Nov 08 '16 at 21:25

1 Answers1

0

I think PHP doesn't run at all. Look in your source code in your browser, if you can see <?php your PHP doesn't work. Create a file "info.php" and write the code: <?php phpinfo(); ?> to test your PHP.

FirePanther
  • 355
  • 1
  • 8