Get the value of the textbox from 1 form to another form in php
<p>I am trying to get the value from 1 form to another in php. In form1 there r fields such as name,email etc. After the  submitting the form it goes to another form where name,email value as to display from the form1. But in my form name,email doesnt display in form2. Here is the code.</p>

<p>form1.php</p>

<pre><code>  &lt;form method="post" name="XIForm" id="XIForm" action="registration.php"&gt;
        &lt;p&gt;&lt;label&gt;Name&lt;/label&gt;&lt;br/&gt;&lt;input type="text" name="fname" id="fname" value="" style="margin-left:30px;" placeholder="Name"&gt;&lt;/p&gt;
        &lt;p&gt;&lt;label&gt;Email&lt;/label&gt;&lt;br/&gt;&lt;input type="text" name="email" id="email" value="" style="margin-left:30px;" placeholder="Email"&gt;&lt;/p&gt;
</code></pre>

<p></p>  </p>

<pre><code>&lt;?php
    include_once 'db.php';
  if(isset($_POST['XISubmit'])) {

         $fname= mysql_real_escape_string($_POST['fname']);
        $email=$_POST['email'];
        $check_email="select * from reg where email='$email'";
        $run1=mysql_query($check_email);

        if(mysql_num_rows($run1)&gt;0){
        echo "&lt;script&gt;alert('email already exits in our database. Please try with Another!')&lt;/script&gt;";
        exit(0);
        }
     else{
              $query = "INSERT INTO reg(fname,username,password,cpassword,email) VALUES ('$fname','$username','$password', '$cpassword','$email')";
              $run11=mysql_query($query);
    $to=$_POST['email'];         
   if($run11){
    $_SESSION['sess_user4']=$username;
    echo "&lt;script&gt;alert('Registration Successful')&lt;/script&gt;";
    echo "&lt;script&gt;window.open('attachfile.php', '_self')&lt;/script&gt;";
    }
    }   
    }
    ?&gt;   
</code></pre>

<p>Form2.php</p>

<pre><code>&lt;form method="post" name="XIForm" action="attach.php" enctype="multipart/form-data" onSubmit="return validate();"&gt;
  &lt;h4 style="color:#6f4617;margin-left:10px;font-size:15px;font-family:Book Antiqua;color:#168eb6"&gt;&amp;nbsp;&amp;nbsp;&lt;b&gt;Welcome &lt;?=$_SESSION['sess_user4']?&gt;  &lt;/b&gt;
&lt;br/&gt;

&lt;label&gt;Confirm Name&lt;/label&gt;&lt;br/&gt;
&lt;input type="text" name="name1" id="name1" style="margin-left:30px;" placeholder="Name" value="&lt;?php if(isset($_GET['fname'])) { echo $_GET['fname']; } ?&gt;"  /&gt;
&lt;br/&gt;&lt;br/&gt;
</code></pre>