You have to make sorting in the form of 1-dimensional arrays that can be filled dynamically with while arbitrarily, then the output must be sorted from small to large nominal.
Example:
Enter numbers: 2
Enter a number: 7
Enter numbers: 3
Enter a number: 8
Enter a number: 15
Enter a number: 9
Enter a number: 20
Enter a number: 4
Sorting results: 2, 3, 4, 7, 8, 9, 15, 20
- note: this is just an example, if you use the while input is not limited, use php ...
this my code, is it true?
echo "<form method=post action=index.php>";
$i=0;
while($i<5){
echo "<input type = text name = txt$i> <br><br>";
$i++;
}
echo "<input type = submit value = submit>";
echo "</form>";
$a = array();
if (isset($_POST['txt0'])) {
$i=0;
while($i<5){
$a[$i] = $_POST['txt'.$i];
$i++;
sort($a);
}
echo "<pre>";
print_r($a);
echo "</pre>";
}