Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    May 2009
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    undefined index error

    I am new in php.I get following error

    undefined index :username on line 12.The code is as below

    <?php session_start();
    if(isset($_COOKIE["usNick"]) && isset($_COOKIE["usPass"])){ ?>
    <META HTTP-EQUIV="REFRESH" CONTENT="0;URL=myaccount.php">
    <?php
    exit();
    }

    $display_error = "";
    $username = "";

    if ($_POST['username']) {
    $username = $_POST['username'];
    if( strtolower($_POST['code'])!= strtolower($_SESSION['texto'])){
    $display_error = "* Security Code Error"; // error language
    include ('error.php');
    exit();
    }else{
    include('includes/config.inc.php');
    $username=uc($_POST['username']);
    $pass=uc($_POST['password']);
    $password = sha1($pass);

    if ($password==NULL) {
    $display_error = "* All fields are required"; // error language
    include ('error.php');
    exit();
    }else{

    please help with this coding
    Last edited by shubho; 05-06-2009 at 09:00 AM. Reason: highlight

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Try changing
    PHP Code:
    if ($_POST['username']) { 
    to
    PHP Code:
    if (isset($_POST['username'])) { 
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    May 2009
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks

    Thanks a lot

    it worked

  • #4
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ya it worked for me too
    thanks


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •