我是新来的!
使用$_POST
,PHP 接受三个数字,只打印偶数且需要排序的数字。我很讨厌这个,但我试过这是我的代码:
<body>
<form name="getallen" action="111.php" form method="POST">
Geef drie getallen in.</br>
Getallen:
<input type="text" name="getallen" maxlength=""/></br>
<input type="text" name="getallen" maxlength=""/></br>
<input type="text" name="getallen" maxlength=""/></br>
<input type="submit" value="controle"/>
</form>
</body>
<?php
$_POST ["getallen"];
if (is_array($_POST['getallen'])) {
echo 'Resultaat: <br />';
foreach ($_POST['getallen'] as $r) {
sort($_POST['getallen']);
echo "<i>$r</i><br />";
}
}else {
echo "Gelieve juiste getallen in te geven";
}
?>