$ _POST []的范围,试图访问$ _POST []变量,得到未定义的索引错误

I have these two forms that submits to different blocks of the same script. i am unable to access variable of one block in other, though both variables are in same script.

html form :(1.php)

<html>
  <form method="POST" action="2.php" enctype="multipart/form-data">
    </br>
    Choose a user name:</font>
    <input type="text" name="username">
    <input type="submit" name="submit" value="Save and Proceed">
  </form>
</html>

2.php:

 <?php
    $name=$_POST['username'];
    if ((isset($_POST['username'])) && ($_POST['submit'] == 'Save and Proceed'))
    {
        $name=$_POST['username'];
        echo $name;
        if($name=='azra')
        {
        ?>
        <html>
          <form method="POST" action="2.php" enctype="multipart/form-data"></br>
            enter age:</font>
            <input type="text" name="age">
            <input type="submit"  name="submit" value="done">
          </form>
        </html>
        <?php
        }
    }

    if((isset($_POST['age'])) && ($_POST['submit'] == 'done'))
    {
        $age=$_POST['age'];
        echo $age;
        if($age==25)
        {
            echo "hi" .$name;
            echo "your age is ". $age;
            echo"you are eligible";
        }
    }   

  ?>

How do I access $_POST['username'] in the code following the html form in the same script? Thank you in advance.

If I understand well you want to pass username twice. Than you can use hidden input, which is not visible (only transports data):

<input type="hidden" name="username" value="<?php echo $_POST['username']; ?>" />

On the second form you can use a hidden input, i.e.:

<input type="hidden" name="username" value="$name">

Example:

<?php

    $name=$_POST['username'];
    if (!empty($_POST['username']) && $_POST['submit'] == 'Save and Proceed'))
    {
        $name=$_POST['username'];
        echo $name;
        if($name=='azra')
        {
            echo <<< LOL
         <html>
        <form method="POST" action="2.php" enctype="multipart/form-data"></br>
        enter age:</font> <input type="text" name="age">
         <input type="hidden" name="username" value="$name">
        <input type="submit"  name="submit" value="done">
        </form>
        </html>
LOL;
        }
    }

    if((isset($_POST['age'])) && ($_POST['submit'] == 'done'))
    {
        $age=$_POST['age'];
        echo $age;
        if($age==25)
        {
            echo "hi" .$name;
            echo "your age is ". $age;
            echo"you are eligible";
        }
    }   

?>