title: Post ajax on https (PHP)
body: <p>yes, i know there is already this kind of question, but i still don't get what i'm doing wrong...</p>
  
  <p>Basically i'm doing a simple Ajax post in jquery to a PHP page, but the xhr status returns me <code>HTTP 500</code></p>
  
  <p>here the code:</p>
  
  <pre><code>    function Register(mailval) {
      var dataString = 'email1=' + mailval;
  </code></pre>
  
  <p><strong>AJAX</strong></p>
  
  <pre><code>    // AJAX code to submit form.
      $.ajax({
      type: "POST",
      url: "register.php",
      data: dataString,
      cache: false,
      success: function(data) {
          alert(data);
          $(".modal-body").html('');
          $(".modal-body").html(data);
      },
        error: function (xhr, ajaxOptions, thrownError) {
          console.log(xhr.status);
          console.log(thrownError);
        }     
      });
  
  }
  </code></pre>
  
  <p><strong>PHP</strong></p>
  
  <pre><code>&lt;?php
  $email2 = $_POST['email1'];
  $connection = mysqli_connect("127.0.0.1", "user", "psw"); 
  $db = mysql_select_db("wnarshix_contatti_form", $connection);
  if (isset($_POST['email1'])) {
      $query = mysql_query("insert into user_registered(mail) values ('$email2')");
      echo "Grazie per esserti registrato";
  }
  mysqli_close($connection); 
  ?&gt;
  </code></pre>
  
  <p>i'm not using mysqli properly?</p>