3 回答

TA貢獻(xiàn)1936條經(jīng)驗 獲得超7個贊
您可以使用$_GET并$_POST請求$_REQUEST
if (isset($_REQUEST['submit'])) {
echo $_REQUEST['length'];
echo $_REQUEST['numPass'];
}
<form method="post" action="">
<input type="number" name="length">
<input type="number" name="numPass">
<input type="submit" value="submit">
</form>

TA貢獻(xiàn)1788條經(jīng)驗 獲得超4個贊
最好檢查輸入以避免可能的錯誤。您可以嘗試以下示例:
<?php
if( $_POST["length"] && $_POST["numPass"] ) {
echo "1: " . $_POST['length'] . "<br>";
echo "2: " . $_POST['numPass'] . "<br>";
echo $_POST['length'] * $_POST['numPass'];
}
?>
<form method="post" action = "<?php $_PHP_SELF ?>">
<input type="number" name="length">
<input type="number" name="numPass">
<input type="submit">
</form>
- 3 回答
- 0 關(guān)注
- 183 瀏覽
添加回答
舉報