title: set cookie when its not checked
body: <p>i have these codes and when i run these it set cookie when checkbox is checked and when is unchecked.
  in both case it set cookie</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$("#login_submit").click(function(){
      var login_username=$('input[name=login_username]').val();
      var login_password=$('input[name=login_password]').val();
      var remember=$("#remember").is(':checked');
  
      $.ajax({
        url:'includes/login.php',
        type:'POST',
        data:{login_username,login_password,remember},
        success:function(data){
          location.href='controlpanel.php';
        },
      });
    });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form onsubmit="return false" class="login-form" action="" method="post"&gt;
    &lt;div class="login-container"&gt;
      &lt;input type="text" class="modal-login" placeholder="username" name="login_username"&gt;
      &lt;input type="password" class="modal-login" placeholder="password" name="login_password" style="margin-bottom:3px"&gt;
      &lt;div class="remember-div"&gt;
        &lt;input type="checkbox" name="remember" id="remember"&gt;
        &lt;label for="remember"&gt;remember me&lt;/label&gt;
      &lt;/div&gt;
      &lt;button type="submit" class="login" name="login_submit" id="login_submit"&gt;login&lt;/button&gt;
    &lt;/div&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>and php codes</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>require_once '../config/config.php';
  
  $login_username=$_POST['login_username'];
  $login_password=md5($_POST['login_password']);
  
  $login_check=mysqli_query($db,"select * from users where username='$login_username' and password='$login_password'");
  $username_id=mysqli_fetch_array($login_check)['id'];
  if(mysqli_num_rows($login_check)&gt;0){
    $_SESSION['login'] = $username_id;
    $remember=$_POST['remember'];
    if($remember){
      setcookie('login',$username_id,time()+60*60*24*30,'/');
    }
    echo "ok";
  }else{
    echo 'ko';
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>in both cases it set cookie when its cheked and when its not checked</p>