title: How to call external javascript file in PHP?
body: <p>I am learning how to call external javascript files in my PHP code. I got some codes from the internet and tried it but its not working. Can somebody pls give me some advice or explain to me this. I am not a programmer but I am studying how to program and just started learning that's why I have difficulty understanding some concepts.</p>
  
  <p>I have here the codes, PHP File and JS file. They are in the same folder.</p>
  
  <p>Here are the codes: </p>
  
  <blockquote>
    <p><b>index.php</b></p>
  </blockquote>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
   &lt;script language="JavaScript" src="exer_1.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
   &lt;form name="myform"&gt;
    &lt;input type="text" id="input_1" name="input_1" /&gt;&lt;br /&gt;
    &lt;input type="text" id="input_2" name="input_2" /&gt;&lt;br /&gt;
    &lt;input type="submit" value="Check!" onclick="javascript:parseTest() return false;" /&gt;
   &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <blockquote>
    <p><b>exer_1.js</b></p>
  </blockquote>
  
  <pre><code>function parseTest() {
   var elem_1 = document.getElementById('input_1');
   var elem_2 = document.getElementById('input_2');
  
   var inp_1 = elem_1.value;
   var inp_2 = elem_2.value;
  
   if (inp_1 == "" &amp;&amp; inp_2 == "") {
    alert("You need to enter integers!!!");
    elem_1.focus();
   } else if (inp_1 == ""){
    alert("You need to enter Integer 1!!!");
    elem_1.focus();
   } else if (inp_2 == ""){
    alert("You need to enter Integer 2!!!");
    elem_2.focus();;
   } else {
    if (!parseInt(inp_1) || !parseInt(inp_2)) alert ("Enter Integers only!!!");
    else {
     alert("Correct Inputs!!!");
    }
   } 
  }
  </code></pre>