Pergunta

I'm trying to use PHP to print out values for my select statements but I can't get it to work. I've even tried just to print something out in my html with php, but i can't even seem to do that. Can anyone tell me what's wrong with this

<html>
<head></head>
<body>
<ul> 
    <?php echo "register Student:"; ?>
</ul> 
</body>
</html>
Foi útil?

Solução

Make sure you save your file as .php not .html.

myfile.php:

<html>
<head></head>
<body>
<ul> 
    <?php echo "register Student:"; ?>
</ul> 
</body>
</html>

You will also need to run this file on a server that has php installed. It won't run directly in the browser like an .html file will.

Outras dicas

Keep these things in mind.

  1. Your file name should always end with .php extension not .htm or .html
  2. You should always run file on localhost/ where you set up your environment
  3. Please follow the standard of W3C Use a "li" in you "ul"

Hope it works.

Name your file whatever.php Make sure it is NOT whatever.html

If that doesn't work, be sure to check whether or not you installed php. I suggest a local testing ground such as XAMPP. If you don't want to do that, upload it to a free or paid hosting service.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top