i am having an error on login form for the field which i carry from another page to login page from URL string, here i have kept a check as
if($_REQUEST['name_']!="")
{
$_SESSION['hidden']=$_REQUEST['name_'];
}
but i get a error as
Notice: Undefined index: name_ in C:\xampp\htdocs\youngants\login.php
What can i do to hide this error, as this error comes when the parameter name_
is not passed by user from contact from from home page,
when the user uses the contact from this error doesn't come on login form. but when a user directly comes to login page this error gets displayed.
below is my entire login code
<?php
if(isset($_SESSION["UserName"]))
{
//Do not show protected data, redirect to login...
//$fullname = $_REQUEST['name_'];
//$_SESSION['hidden']=$fullname;
header('Location: dashboard.php');
exit();
}
else
{
if($_REQUEST['name_']!="")
{
$_SESSION['hidden']=$_REQUEST['name_'];
//echo $_SESSION['hidden'];
}
if(isset($_POST['login']))
{
$username=$_POST['Username'];
$user_pass=$_POST['password'];
$encrypt_pass = md5($user_pass);
$check_user="select * from tbl_logindetails WHERE UserName='".$username."' AND Password='".$encrypt_pass."'";
$run=mysqli_query($connection,$check_user);
if(mysqli_num_rows($run))
{
header("Location: dashboard.php?name_=".$_SESSION['hidden']."&subject_=".$_GET['subject_']."&phone_=".$_GET['phone_']."&email_=".$_GET['email_']."&message_=".$_GET['message_']);
$_SESSION['UserName']= $username; //here session is used and value of $user_email store in $_SESSION.
}
else
{
echo "<script>alert( 'Error in Logging Useer, Please try again later' )</script>";
}
}
}
?>