Taking input from user for number of players in index.php
<html>
<body>
<form action="welcome.php" ; method="post">
Enter number of players : <input type="number" name="players"> \\Selecting number of players
<input type="submit">
</form>
</body>
</html>
<html>
<body>
<?php $p=$_REQUEST['players']; echo $p;?>
<br>
<br>
<br>
<br> So we have
<?php echo $_POST["players"]; ?> players playing today!<br>
<br>
<form action="name.php" method="post">
<?php
for($i=1;$i<=$_POST["players"];$i++):?> Player
<?php echo $i;?> name:<input type="text" name="<?php echo $i;?>"> <br>
<?php endfor;?>
<input type="submit">
</body>
</html>
<html>
<br>
<?php
for($i=1;$i<=10;$i++): <--Instead of $i<=10 I want to use the number of players from index.php -->
echo "Name :".$_POST[$i];//can I use $_POST['players']
?>
<input type="submit">
<br>
<?php endfor; ?>
</html>
I am receiving error if I use POST method may be because value is from index.php, and name.php has no connection with it.