【发布时间】:2019-04-19 18:26:46
【问题描述】:
我正在做一个项目,以获取两个提交的变量并将它们转换为 php 变量(最终它们会相乘),但到目前为止我无法将变量视为这样/echo。
我尝试从 POST 更改为 GET,变量通过发送(出现在查询行中)但它们没有打印在页面上
<?php
if (isset($_POST['submit'])) {
echo $_POST['length'];
echo $_POST['numPass'];
}
?>
<form method="post" action="">
<input type="number" name="length">
<input type="number" name="numPass">
<input type="submit">
</form>
我希望变量将作为常规语句回显。 IE。 length=2 和 numPass=4
24
【问题讨论】:
-
尝试
echo "<pre>"; print_r($_POST); echo "</pre>\n";测试您的输入。 -
请使用
$_REQUEST或$_GET代替post