0

So we got 2 types of tags which my lecture finds me wrong of using when we talking about php

Which one belongs to the other ?

<body>
<script src="myPhp.php">
Echo
</script>
</body>

&

<body>
<?php
Echo
 ?>
</body>

My lecturer is marking me wrong for using the first tag in my php exam

Ken Lee
  • 6,985
  • 3
  • 10
  • 29

1 Answers1

3

The <script src="xxxx"></script> statement in a HTML file is used for including an external Javascript (JS) file, such as

<script src="myscripts.js"></script>

to include another PHP file (in a PHP file), you need something like

<?php include "myPhp.php"; ?>

Please note that Javascript is a client-side language and PHP is a server-side language, so make sure you understand what you are trying to accomplish when using them.

For further reference, you may see what-is-the-use-of-javascript and what is PHP and other related articles

Ken Lee
  • 6,985
  • 3
  • 10
  • 29