title: calling javascript function from php code function is not defined
body: <p>I have the following segment of code that calls showKML javascript function from php code. However, it gave me the following error: <strong>Uncaught ReferenceError: showKML is not defined</strong>. </p>
  
  <pre><code>&lt;?php
      $upload = $_SERVER['PHP_SELF'];
      if(isset($_POST['kmltest'])) {
          $target_path = "uploads/";
          $fn =  basename( $_FILES['uploadedfile']['name']);
  
          $target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
          //echo $target_path ;
          if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
              echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
              echo "&lt;script type=\"text/javascript\"&gt; showKML(); &lt;/script&gt;";  
          }else
              echo "There was an error uploading the file, please try again!";
  
      }
  ?&gt;
  &lt;script  type="text/javascript"&gt;
      function initialize() {
          if (GBrowserIsCompatible()) {
              map = new GMap2(document.getElementById("map"));
              map.setCenter(new GLatLng(25.22903, 55.46612), 13);
              map.addControl(new GSmallMapControl());
              map.addControl(new GMapTypeControl());
              map.clearOverlays();
              document.getElementById("lat").value = "25.22903";
              document.getElementById("lng").value = "55.46612";
          }
      }
  
      function showKML() {
      //alert(filename);
          initialize();
          document.getElementById('lat').disabled = true;
          document.getElementById('lng').disabled = true;
          var exml;
          exml = new EGeoXml("exml", map, ("uploads/test.kml"));
          exml.parse();
          exml.show(); 
      }
  
      function startShape() {
          ...
      }
  
      function startDrawing(poly, name, onUpdate) {
             ... 
      }
  
      function showcoor (poly) {
          ...
      }
  
      function drawpoint() {
          ...
      }
  
      &lt;/script&gt;
  </code></pre>
  
  <p>your help is really appreciated     </p>