0

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>
2
Contributors
10
Replies
11
Views
4 Years
Discussion Span
Last Post by hwoarang69
Featured Replies
  • **@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: … Read More

  • >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? Read More

  • >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 … Read More

  • In your session do you have `session_unset();` ? Read More

  • 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(); ?> Read More

4

@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'];
}
?>

Edited by LastMitch: grammer

Votes + Comments
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.

4

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?

Votes + Comments
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.

4

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.

Votes + Comments
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.

Edited by hwoarang69

4

In your session do you have session_unset(); ?

Votes + Comments
To Rectify what some retard did to LastMitch
4

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();
?> 

Edited by LastMitch: grammer

Votes + Comments
To Rectify what some retard did to LastMitch
0

fixed the problem. turn out there was no index.

isset($_POST['remember']) 

works fine.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.