title: jQuery cannot pass local storage to PostgreSQL via php on AWS with Phonegap app
body: <p>I am slightly new to programming, I have had a few friends help me out with getting my Phone Gap app to post local storage to Postgres via PHP. When I had the PHP hosted on a local server, the jQuery was connecting to the PHP page and posting correctly to my Postgres database. </p>
  
  <p>However, as soon as I migrated everything over to AWS, the jquery was unable to connect to (or find?) the PHP page. </p>
  
  <p>My jQuery function is as follows</p>
  
  <pre><code>function submitForm() {
  var string = localStorage.getItem("entry");
  $.get("http://www.mywebsite.com/get.php", { q: string } ).done( function() { window.location = "#/app/thanks";}).fail( function() { alert('Please check your Internet connection and try again.'); });
  return 1;
  }    
  </code></pre>
  
  <p>and my PHP</p>
  
  <pre><code>&lt;?php
  
  
  $query = $_GET['q'];
  
  $array = explode("|", $query);
  
  $species = explode(",", $array[2]);
  
  $array2 = explode(",", $array[3]);
  
  
  $i = 0;
  
  $db = pg_connect("host=&lt;aws db endpoint&gt; port=5432 dbname=database user=postgres password=&lt;my    password&gt;) or die('Could not connect: ' . pg_last_error());
  
  for($i=0;$i&lt;10;$i+=2) {
      if($i == 0) {
          $fishKept = $array2[1];
          $hoursFished = $array2[2];
  }
  else {
      $fishKept = 0;
      $hoursFished = 0;
      }
      $q = "INSERT INTO creel(waterbody_id, species, species_length_id, fish_caught, fish_kept,     hours_fished, date) VALUES('".$array[0]."', '".$array[1]."', '".$species[$i]."', '".$species[$i+1]."', '".$fishKept."', '".$hoursFished."', '".$array2[0]."');";
      $result = pg_query($db, $q);
  
  }
  pg_close($db);
  ?&gt;
  </code></pre>
  
  <p>When I try to run the function, it gives me the alert "Please check your internet connection and try again", which tells me the function is failing. Currently the php is in <code>/var/www/html</code> on my AWS server. Does the PHP need to be in a certain place? I didn't change any of the code, so I do not see why it would work for posting to the local server but not AWS.</p>
  
  <p>I have my Postgres database set up using RDS, and I am able to connect to it with pgAdminIII on my computer, so I do not think it is a security issue. </p>
  
  <p>I believe I have all my login info correct for Postgres, but it doesn't seem to be running the PHP at all. </p>