-1

I am trying to make something like facebook "keep me logged in".I want to use checkbox for storing data, or just to make a code that will check if the checkbox is clicked, and if yes, it should make $remember_me: "true"; and if not $remember_me: "false".
HTML

<input type="checkbox" /> Keep me logged in
Crion
  • 199
  • 1
  • 1
  • 9
  • Like all other `` elements, checkboxes have a `value` attribute you can set. – Jon May 15 '14 at 11:50
  • @ Rakesh Shetty I never done something like this, so i have no idea how to check if checkbox is clicked, i tried on google but haven't got any ideas so far.I keep searching. – Crion May 15 '14 at 11:51
  • name="remember_me" and check it on its $_POST ?, if its not set it will be empty, if it is set it will be whatever value is. – viion May 15 '14 at 11:51
  • @Crion see http://www.downwithdesign.com/web-development-tutorials/adding-remember-feature-php-login-script/. Like this there are many tutorial available. Just ask [Google](https://www.google.com) – Rakesh Shetty May 15 '14 at 11:53
  • possible duplicate of [PHP Sessions Login with remember me](http://stackoverflow.com/questions/12091951/php-sessions-login-with-remember-me) – Rakesh Shetty May 15 '14 at 11:55
  • @ Rakesh Shetty why duplicate, i don't want "php sesion login" i just want to try to store value to $remember_me – Crion May 15 '14 at 12:01
  • so @Crion why just get the post value of that checkbox into the variable? where is the problem ??? – Rakesh Shetty May 15 '14 at 12:03
  • @ Rakesh Shetty Give me few seconds, i will try to make code. – Crion May 15 '14 at 12:04
  • @Crion for your better understanding see http://stackoverflow.com/questions/19893927/send-checkbox-value-in-php-form – Rakesh Shetty May 15 '14 at 12:05
  • @ Rakesh Shetty thank for ur help, and tutorials u gave me, i made what i wanted and it works perfectly.Thanks once again :D – Crion May 15 '14 at 12:17

1 Answers1

0
<input type="checkbox" name="remember_me" value="Yes" />

<?php
if (isset($_POST['remember_me'])) {
    $remember_me: "true";
}
else {
    $remember_me: "false"
}

I'd probably recommend not stringing the boolean for true/false

viion
  • 365
  • 2
  • 10