title: Delete cookie php
body: <p>I am trying to make a platform with a login system and I am storing the username and the password in cookies to make the user stay logged in even if it closes the browser and then enters again. I managed to save the cookies but I don't know how to make the logout button.
  Here is the code:</p>
  
  <pre><code>function logout() {
    $('body').append("&lt;?php setcookie('username', null); setcookie('password', null); unset $_COOKIE['username']; unset $_COOKIE['password']; ?&gt;");
    location.assign("index.php");
  }
  </code></pre>