Hi While login into the site iam getting the username in hidden field while filling the form after login i need to insert the username in database.But iam getting The error as
Notice: Undefined index: email
Here is my code
index.php
<?php
$username = $_SESSION['username'];
if($username)
{
?>
<h3> Welcome <?php echo $username; ?></h3>
<?php
}
else
{
echo "no";
}
?>
<body>
<input type='hidden' value="<?php echo $username; ?>" name='email'>
<input type="button" value="Logout" id="logout" onClick="document.location.href='login.php'" />
<form method="post" action="details.php" id="myform">
<ul class="tab-content">
<li class="tab-pane active" id="salary">
<h3>Details</h3>
<table style="border-collapse: collapse;border: 1px solid black;">
<tr class="spaces">
<th>User Name</th></tr>
<tr>
<td><input type="text" name="user_name" value="" required /></td>
</tr>
details.php
<?php
$connection = mysql_connect("localhost", "root", "") or die(mysql_error());
$db = mysql_select_db("accountant", $connection);
$email=$_POST['email'];
$name=$_POST['user_name'];
$query=mysql_query("INSERT INTO user_details(email,user_name)values('$email','$name')");
Can anyone help me this thanks in advance
While filling this form i need to insert the hidden field value also in database