title: Post and ajax / php wont talk together?
body: <p>I have to files, one of them being index.php and the other being survey-result.php.</p>
  
  <p><strong>Index.php</strong> contains a survey, and a button, and a click on the button should post surveyname and result to survey-result.php. The survey-result.php should then make a mysql connection, and update the database with the result from index, ind the correct survey. </p>
  
  <p>URL example: index.php?id=528E6B678ECE0</p>
  
  <p>Id is a surveyname, that exsists in a mysql database.</p>
  
  <p><strong>The problem:</strong> There is no connection between the two php files. If I run the survey-result with manual data in result and surveyname, then it will update my database.</p>
  
  <p>Any ideas ? : D</p>
  
  <pre><code>&lt;input type='button' value='Create User' onclick='updateSurvey()' /&gt;;
  
      function updateSurvey()
      {
  
            $.ajax(
                  {
                      url: 'handlers/survey-result.php',
                      data:
                      {
                          action: 'action',
                          surveyname: &lt;?php echo $_GET["id"]; ?&gt;,
                          result: 'Test Result',
                          type: 'post',
                          success: function(output)
                          {
                              alert("Survey result updated");
                          }
  
                  });
      }
      &lt;/script&gt;
  </code></pre>
  
  <p><strong>handlers/survey-result.php</strong></p>
  
  <pre><code>&lt;?php
  
  if(isset($_POST['action']) )
  {
      include("include/dbConnect.php");
  
      $strSQL = " UPDATE surveys
                  SET result= . $_POST['result'] .
                  WHERE surveyname= . $_POST['surveyname']";
  
      // The SQL statement is executed
      mysql_query($strSQL) or die (mysql_error());
  
      // Close the database connection
      mysql_close();
  }
  ?&gt;
  </code></pre>