Notice: Undefined index: remember in C:\xampp\htdocs\E_COMMERCE\login.php on line 15
line15: $remember_p = $_POST['remember'];
it looks right to me. any ideas?

<?php
    if($_SERVER['REQUEST_METHOD'] == 'POST') 
    {
        $username_p = $_POST['username'];
        $password_p = $_POST['password'];
        $remember_p = $_POST['remember'];
        .....
        }
?>

 <div id = "right_login">
            <form  id='login' action='login.php' method='POST'>
                <h1>Log in to your account!</h1>
                <?php
                    //print errors
                   if(array_key_exists('log_error', $_SESSION) && !empty($_SESSION['log_error']))
                    {
                        $log_error_r = $_SESSION['log_error'];
                        echo "<span id='error_print' tyle='background-color:#D00000;'> $log_error_r <br/></span>";
                        unset($_SESSION['log_error']);
                    }
                ?>
                <div class="outer_hint">
                    <label>Username:</label> 
                    <input type="text" name="username" id="login_username" class="field" value="<?php $val = $_POST['username']; echo $val;?>" />
                    <!-- HINT --><span class="hint">6 to 20 characters(letters and numbers only)</span>
                </div>           

                <div class="outer_hint">
                    <label>Password:</label>
                    <input type="text" name="password_txt" id="login_password_text" class="field" value=""/>
                    <input type="password" name="password" id="login_password" class="field" value=""/>
                    <!-- HINT --><span class="hint">6 to 20 characters(letters and numbers only)</span>
                </div>           

                <p class="forgot"><a href="#">Forgot your password?</a></p>

                <div id="submit">
                    <button type="submit" id="login_button" class="button" >Log in</button> 
                        <label>
                            <input type="checkbox" name="remember" id="login_remember" value="yes" />
                                <p id ="login_stay">Keep me signed in</p>
                        </label>    
                </div>
             </form>
            </div>
Member Avatar for LastMitch

@hwoarang69

Notice: Undefined index: remember in C:\xampp\htdocs\E_COMMERCE\login.php on line 15
line15: $remember_p = $_POST['remember'];

It means this is undefined:

$remember_p = $_POST['remember'];

Is this connected or does it existed?

$remember_p = $_POST['remember'];

Right now, it seems like it's not connected or existed in your database

I overlook something:

$_SERVER['REQUEST_METHOD']

Read this about it:

http://php.net/manual/en/reserved.variables.server.php

This variable doesn't work anymore.

Try this, I'm not sure it will work base on your code.

<?php
if($_POST){
$username_p = $_POST['username'];
$password_p = $_POST['password'];
$remember_p = $_POST['remember'];
}
?>
commented: To Rectify what some retard did to LastMitch +0

Is this connected or does it existe

yes its connected to check box in html form. i couldnt understant why its give me error. bc i connect username the same way and it works fine.

Member Avatar for LastMitch

yes its connected to check box in html form. i couldnt understant why its give me error. bc i connect username the same way and it works fine.

array_key_exists()

Do you have an array?

commented: To Rectify what some retard did to LastMitch +0

i might be wrong but why would you need a array for this? its just a check box. i can test in if statment by value. on or off.

Member Avatar for LastMitch

i might be wrong but why would you need a array for this? its just a check box. i can test in if statment by value. on or off.

Did write this code? Yes, the code you provide require an array.

Read this or look how the array looks like here:

http://php.net/manual/en/function.array-key-exists.php

So maybe you can find that array or somewhere in your code.

commented: To Rectify what some retard did to LastMitch +0

i read it but i still dont see why would i need array in my code. may be iam not explain the question right.
les say i have textfield and checkbox

 <input type="text" name="username"   value="hi"/>
 <input type="checkbox" name="remember" value="yes" />

now i just want to get there values by using php.

  $username_p = $_POST['username'];  //this sould give me hi
  $remember_p = $_POST['remember'];  //this sould give me "yes" 

now username_p works fine.
but remember_p gives me error and i now what the error means. i just dont undertand why its give me it. i have connect username and remember in html code.

Member Avatar for LastMitch

In your session do you have session_unset(); ?

commented: To Rectify what some retard did to LastMitch +0

just
session_start();

Member Avatar for LastMitch

Read this and decide which session you want:

http://www.w3schools.com/php/php_sessions.asp

I copy and paste the code from the link but it would be helpful if you read it

You can used this:

<?php
session_start();
if(isset($_SESSION['views']))
  unset($_SESSION['views']);
?> 

or you can used this:

<?php
session_destroy();
?> 
commented: To Rectify what some retard did to LastMitch +0

fixed the problem. turn out there was no index.

isset($_POST['remember']) 

works fine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.