How to insert the hidden field data into database using php
<p>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 </p>

<p>Notice: Undefined index: email </p>

<p>Here is my code</p>

<p>index.php</p>

<pre><code>&lt;?php  
$username = $_SESSION['username'];
if($username) 
{ 
?&gt;
&lt;h3&gt; Welcome &lt;?php echo $username; ?&gt;&lt;/h3&gt;
&lt;?php 
}  
else 
{ 
echo "no"; 
} 
?&gt; 
&lt;body&gt;       
    &lt;input type='hidden' value="&lt;?php echo $username; ?&gt;" name='email'&gt;        
    &lt;input type="button" value="Logout" id="logout" onClick="document.location.href='login.php'" /&gt;    
    &lt;form method="post" action="details.php" id="myform"&gt;            
        &lt;ul class="tab-content"&gt;
                &lt;li class="tab-pane active" id="salary"&gt;                
                            &lt;h3&gt;Details&lt;/h3&gt;
                            &lt;table style="border-collapse: collapse;border: 1px solid black;"&gt;
                            &lt;tr class="spaces"&gt;
                              &lt;th&gt;User Name&lt;/th&gt;&lt;/tr&gt;
                              &lt;tr&gt;
                              &lt;td&gt;&lt;input type="text" name="user_name" value="" required /&gt;&lt;/td&gt;
                              &lt;/tr&gt;
</code></pre>

<p>details.php</p>

<pre><code>&lt;?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')");
</code></pre>

<p>Can anyone help me this thanks in advance</p>

<p>While filling this form i need to insert the hidden field value also in database</p>