在另一个中使用isset结果

I have a problem when developping a page in php, when click on a submit button another submit button. appear. my problem appeared at the isset of this submit button, echo $b doesn't work; here is my code:

<form method='POST'>

<input type="submit" name="s1">

</form>
</body>
</html>

<?php
if(isset($_POST["s1"])){
$b=2;
echo "<form method='POST'><input type='submit' name='s2'></form>";
if(isset($_POST["s2"])){
echo $b;
}
}

I've already tried to make $b a global variable, but no change :( Thank's for your help.

The flow of your code is first send the value of input s2, if this was set with some value echo your second form and set b variable to 2, when your second form is printed out on the browser the b value will have lost, so your must store this value in some place, this could be done through a hidden field in your second form like this:

echo "<form><input type='text' name='s2'><input type='hidden' name='b' value='$b'></form>"
if(isset($_POST["s2"])){
    echo $_POST['b'];
} 

Hope this helps you!