title: Is there a reason why my php code won't run with the HTML?
body: <p>I'm practicing php right now on a simple web form problem. Long story short, I just need to create a very basic web form that takes in a two-dimensional array of European cities which show the distance in km of how far away it is from other European cities. All I need to do is create a web form where you can input any city found in that two-dim array and have it calculate the distance between the Start city and the End city (i.e Berlin is located blah miles away from Prague after inputting "Berlin" and "Prague" in the text field.</p>
  
  <p>I think I have the problem almost solved but the issue is that phpstorm is telling me that certain variables are undefined even though they were already defined in my function and as a variable before that function. I apologize if this problem seems trivial but I'm just learning to digest php at the moment. Here is my code below. I included the html and the php code in one page.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Distance between European Cities&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;Distance between European Cities&lt;/h1&gt;
  &lt;h2&gt;Enter valid European cities from this list: Berlin, Moscow, Paris, Prague, Rome&lt;/h2&gt;
  &lt;?php
  $Distances = array(
      "Berlin" =&gt; array("Berlin" =&gt; 0, "Moscow" =&gt; 1607.99, "Paris" =&gt; 876.96, "Prague" =&gt; 280.34, "Rome" =&gt; 1181.67),
      "Moscow" =&gt; array("Berlin" =&gt; 1607.99, "Moscow" =&gt; 0, "Paris" =&gt; 2484.92, "Prague" =&gt; 1664.04, "Rome" =&gt; 2374.26),
      "Paris" =&gt; array("Berlin" =&gt; 876.96, "Moscow" =&gt; 641.34, "Paris" =&gt; 0, "Prague" =&gt; 885.38, "Rome" =&gt; 1105.76),
      "Prague" =&gt; array("Berlin" =&gt; 280.34, "Moscow" =&gt; 1607.99, "Paris" =&gt; 885.38, "Prague" =&gt; 0, "Rome" =&gt; 922),
      "Rome" =&gt; array("Berlin" =&gt; 1181.67, "Moscow" =&gt; 2374.26, "Paris" =&gt; 1105.76, "Prague" =&gt; 922, "Rome" =&gt; 0));
  $KMtoMiles = 0.62;
  $City1 = $_POST['firstCity'];
  $City2 = $_POST['secondCity'];
  function euDis($City1, $City2, $Distances){
  if (empty($City1) || empty($City2)) {
      echo "Please input two cities in the required fields.&lt;br /&gt;\n";
  } elseif (in_array($City1, $Distances) == FALSE || in_array($City2, $Distances) == FALSE) {
      echo "You inputted one or more cities that are not in our list.&lt;br /&gt;";
  } else {
      if (isset($_POST['submit'])) {
          $City1 = stripslashes($_POST['firstCity']);
          $City2 = stripslashes($_POST['secondCity']);
          if (isset($Distances[$City1][$City2])) {
              echo "&lt;p&gt;The distance from $City1 to $City2 is " . $Distances[$City1][$City2] . " kilometers or " . round((0.62 * $Distances[$City1][$City2]), 2) . " miles.&lt;/p&gt;\n";
          } else {
              echo "&lt;p&gt;$City1 and $City2 are not in this list.&lt;/p&gt;\n";
          }
      }
  }
  }
  ?&gt;
  &lt;form action= "eudistance.php" method="post"&gt;
  
  City 1: &lt;input type="text" name="firstCity" /&gt;&lt;br /&gt;
  
  City 2: &lt;input type="text" name="secondCity" /&gt;&lt;br /&gt;
  
  &lt;input type="reset" value="Clear All" /&gt;
  
  &lt;input type="submit" name="submit" value="Enter" /&gt;
  
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>