title: RetroFit Failing to send POST request
body: <p>I've been trying to send a POST request to a php script in order to update the value of a table in a MySQL database. I've been using RetroFit of late and have used it to send quite a few POST request for POST based operations. I don't know if my problem occurs because I am violating HTTP best practices which would recommend to use PUT for update operations but I have also tried sending a PUT request from the Client although it had the same outcome. The database values were not changed when I checked them. Here is the code where I send the HTTP Post Request from RetroFit.</p>
  
  <pre><code>                    final JsonDataAPI API = RetroFitClient.getInstance().getAPI();
                      Map&lt;String, String&gt; voteParams = new HashMap&lt;String, String&gt;();
                      voteParams.put("pollID", String.valueOf(pollID));
                      voteParams.put("optText", rb1.getTag().toString());
                      Call &lt;ArrayList&lt;PollOpt&gt;&gt; voteCall = API.makeVote(voteParams);
                          voteCall.enqueue(new Callback&lt;ArrayList&lt;PollOpt&gt;&gt;() {
                              @Override
                              public void onResponse(Call&lt;ArrayList&lt;PollOpt&gt;&gt; call, Response&lt;ArrayList&lt;PollOpt&gt;&gt; response) {
                                  if(!response.isSuccessful()){
                                      Toast.makeText(PollPage.this, "Vote Unsuccessful for vote 2", 
                                     Toast.LENGTH_SHORT).show();
                                  }   else{
                                      Toast.makeText(PollPage.this, "Vote Successful for vote 2", 
                                    Toast.LENGTH_SHORT).show();
                                  }
                              }
  
                              @Override
                              public void onFailure(Call&lt;ArrayList&lt;PollOpt&gt;&gt; call, Throwable t) {
                                  Log.d("TAG", "Vote Failure: " + t.getMessage());
                                  Log.d("TAG", "FailureURL rb2: " + call.request().url().toString());
                              }
                          });
  </code></pre>
  
  <p>The URL of the requests is just fine it even prints the request in the onFailure function which fires as there is no response, although I don't expect a response.</p>
  
  <p>This is the part of the PHP API code the request is getting sent too <em>Vote.php</em>: </p>
  
  <p>'          </p>
  
  <pre><code>    method = $_SERVER['REQUEST_METHOD'];
  
      switch($method){
  
      case "POST":
  
      if(isset($_POST["optText"]) &amp;&amp; isset($_POST["pollID"])){
  
          $optText = $_POST["optText"];
          $pollID = (int) $_POST["pollID"];
  
          $query = "UPDATE polloption SET frequency = frequency + 1 WHERE pollID = " . $pollID . " AND optText = '". $optText ."'";
  
          $conn = new mysqli($host, $user, $pass, $database);
      if ($conn-&gt;connect_error)
          die($conn-&gt;connect_error); 
  
          if(mysqli_query($conn, $query)){
              echo "Updated Poll Frequency";
          } else{
              echo "Failed to Update Poll Frequency";            
          }
  
  
  
      }
  
      break;'
  </code></pre>
  
  <p>I've tested the PHP code out using AJAX scripts seeing as you can see phps echo data in the AJAX Requests response whereas in Android you are basically working in the dark when sending HTTP Requests with methods other than GET and determining errors without having to individually test each file with an AJAX Request. After testing the server with AJAX scripts multiple times with different parameters, I can't see why the frequency value doesn't update when sending POST requests through RetroFit. </p>
  
  <p>Any advice on this would be much appreciated!</p>