title: pass value to another page in php
body: <p>I have a log in page that I want to pass a value to from another page... but it wont pass can anyone help me? please.</p>
  
  <p>login page code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;?php 
     ob_start();
     session_start();
     include('include/connect.php');
  
  ?&gt;
  
  &lt;html&gt;
     &lt;head&gt;
        &lt;title&gt;test&lt;/title&gt;
     &lt;/head&gt;
     &lt;body&gt;
        &lt;form action="" method="post"&gt;
           &lt;input type="text" name="username"&gt;
           &lt;input type="text" name="password"&gt;
           &lt;input type="submit" name="login" id="send" /&gt;
        &lt;/form&gt; 
     &lt;/body&gt;
  &lt;/html&gt;
  
  &lt;?php
     // Inialize session
     if(isset($_POST['login'])){
        $username=$_POST['username'];
        $password=$_POST['password'];
        $repcode=$_POST['repcode'];
        // Include database connection settings
        include('connection.php');
        // Retrieve username and password from database according to user's input
        $login = mysql_query("SELECT * FROM users WHERE username = '$username' and password = '$password'");
  
        // Check username and password match
        if (mysql_num_rows($login) == 1) {
           // Set username session variable
           $_SESSION['username'] = $_POST['username'];
           $_SESSION['repcode'] = $_POST['repcode'];
           // Jump to secured page
           $stat = "UPDATE users SET status='login'";
           mysql_query($stat);    
           header('Location: home2.php');
         }else {
         }
      }
  ?&gt;
  </code></pre>
  
  <p>page to be passed:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;?php 
     ob_start();
     session_start();
     include('include/connect.php');
  
  ?&gt;
  &lt;html&gt;
     &lt;head&gt;
        &lt;title&gt;test&lt;/title&gt;
     &lt;/head&gt;
     &lt;body&gt;
        &lt;form method="get"&gt;
           &lt;input type="text" name="username" value="&lt;?php echo $_POST['username']; ?&gt; "/&gt;
           &lt;input type="text" name="repcode" value="&lt;?php echo $_POST['repcode']; ?&gt; "/&gt;
        &lt;/form&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I want to pass the username and repcode to another page and put it in textboxes. Can anyone help me with this...I'm new in php and still learning.</p>