...

View Full Version : undefined index error



shubho
05-06-2009, 08:53 AM
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

abduraooft
05-06-2009, 09:03 AM
Try changing


if ($_POST['username']) { to

if (isset($_POST['username'])) {

shubho
05-06-2009, 10:59 AM
Thanks a lot

it worked

vineet2011
07-22-2012, 10:23 AM
ya it worked for me too
thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum