title: session variables are not inserting in database in php and mysql form
body: <p>It is not inserting the session variables like <code>name, id ,email, number</code> like which is stored in <code>$a,$b,$c,$d</code> in <code>pseller.php</code></p>
  
  <p>This is my login page where i am checking username and password</p>
  
  <blockquote>
    <p>login.php</p>
  </blockquote>
  
  <pre><code>  &lt;?php
  
  
       error_reporting(E_ALL); // to see if there is error in code
  
  
       include "connect_to_mysql.php";
       if(isset($_POST['log']))
       {
  
        $user= $_POST['user'];
        $pass= md5($_POST['pass']);
  
        $sql=mysql_query( "select * from reg where username= '$user' AND password='$pass' AND category='product seller' LIMIT 1 ") or die( mysql_error());
        $data=mysql_num_rows($sql);
        if ($data == 1) {
           $_SESSION['name']=$name;
              $_SESSION['id']=$id;
              $_SESSION['phone_no']=$number;
              $_SESSION['email_id']=$email;
  
          header("location:pseller.php");
  
         }
  
  
      else {
      header("location:login.php?error");
  
           }
      }
      ?&gt;
  
  
  
           &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
           &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
             &lt;head&gt;
                &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
                   &lt;title&gt; Log In &lt;/title&gt;
                       &lt;link rel="stylesheet" href="style.css" type="text/css" media="screen" /&gt;
                        &lt;/head&gt;
  
                     &lt;body&gt;
  
  
  
          &lt;div id="mainWrapper"&gt;
  
       &lt;div id="pageContent"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
        &lt;div align="right" style="margin-right:24px; color:#FF0000"&gt;
  
    &lt;br /&gt;&lt;br /&gt;
    &lt;form id="form" name="form" method="post" action="login.php"&gt;
      &lt;h2 style="padding-right:200px;"&gt;User Name:&lt;/h2&gt;
        &lt;input name="user" type="text" id="user" size="40" style="height:30px;" required placeholder="Enter Email"/&gt;
     &lt;br /&gt;&lt;br /&gt;
      &lt;h2 style="padding-right:210px;"&gt;Password:&lt;/h2&gt;
     &lt;input name="pass" type="password" id="pass" size="40" style="height:30px;" required/&gt;
     &lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
  
     &lt;img style="padding-right:190px;" src="generate.php"&gt;&lt;br /&gt;&lt;br /&gt;
     &lt;input type="text" name="secure" size="10" required placeholder="Enter The Value" style="padding-right:210px; height:30px;"&gt;
         &lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
       &lt;input type="submit" name="log" id="log" value="Log In"  style="padding-right:40px;" /&gt;
  
  
  
  
  
    &lt;/form&gt;
    &lt;p&gt;&amp;nbsp; &lt;/p&gt;
     &lt;/div&gt;
      &lt;br /&gt;
       &lt;br /&gt;
      &lt;br /&gt;
     &lt;/div&gt;
  
         &lt;/div&gt;
          &lt;/body&gt;
           &lt;/html&gt;
  </code></pre>
  
  <p>This is <code>pseller</code> page where I am trying to store session values in variables then inserting in database. but session variables are not inserting data in database and showing the value of <code>v_id v_number as 0</code>.</p>
  
  <blockquote>
    <p>pseller.php</p>
  </blockquote>
  
  <pre><code>    &lt;?php 
      // Parse the form data and add inventory item to the system
  
      include_once('connect_to_mysql.php');
      session_start();
  
     if (isset($_POST['p_name'])) {
  
  
         $target_dir = "pics/";
         $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
         $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
         move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file) ;
         $img_name = $_FILES["fileToUpload"]["name"];
  
  
          $a=$_SESSION['name'];
          $b=$_SESSION['id'];
          $c=$_SESSION['phone_no'];
          $d=$_SESSION['email_id'];
  
       $product_name = mysql_real_escape_string( $_POST['p_name']);
      $price = mysql_real_escape_string($_POST['price']);
      $category = mysql_real_escape_string($_POST['category']);
     $subcategory = mysql_real_escape_string($_POST['subcategory']);
     $category2 = mysql_real_escape_string($_POST['category2']);
      $details = mysql_real_escape_string($_POST['details']);
      // See if that product name is an identical match to another product in the system
  
    // Add this product into the database now
      $sql = mysql_query("INSERT INTO product (p_name, price, details, category, sub_category, category2, img_name, v_id, v_name, v_number, v_email, date) VALUES('$product_name','$price','$details','$category','$subcategory','$category2','$img_name','$b','$a','$c','$d',now())") or die (mysql_error());
  
  
  
     }
     ?&gt;
  </code></pre>
  
  <p>Please help me to come out from here.</p>