Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用PHP检索用户输入并回显它_Php_Input - Fatal编程技术网

使用PHP检索用户输入并回显它

使用PHP检索用户输入并回显它,php,input,Php,Input,我想知道是否可以使用PHP(最好是ID或我可以使用数字的东西)获取HTML用户输入,并且为了避免混淆,只需回显它就可以了 我这里有一些示例代码: <input type="number" maxlength="3" name="test" id="1"> <input type="number" maxlength="3" name="test" id="2"> <input type="number" maxlength="3" name="test" id="2

我想知道是否可以使用PHP(最好是ID或我可以使用数字的东西)获取HTML用户输入,并且为了避免混淆,只需回显它就可以了

我这里有一些示例代码:

<input type="number" maxlength="3" name="test" id="1">
<input type="number" maxlength="3" name="test" id="2">
<input type="number" maxlength="3" name="test" id="2">


我所寻找的是一种方法,我可以利用他们的意见,以及。。。。现在回显它。

如果您已经知道如何提交表单,您可以使用php在另一端这样回显它

<form method="POST" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">
<input type="text" name="name"><br>
<input type="submit" name="submit" value="Submit Form"><br>
</form>

<?php 
if (isset($_POST['name'])){
$userinput = $_POST['name'];
echo $userinput;}
?>

您对这些输入使用了哪种方法?以不同的方式命名,然后使用以下方法检索数据:

 <?php echo $_GET['test1']; ?>
 <?php echo $_GET['test2']; ?> 
 <?php echo $_GET['test3']; ?>  

如果在输入法中使用POST类型,则切换为:

<?php echo $_POST['test1']; ?> 
<?php echo $_POST['test2']; ?>
<?php echo $_post['test3']; ?> 

问题是,我愿意使用任何类型的方法将其提交给PHP。但我希望能够将PHP放在同一个页面上,这样我就可以在同一个页面上进行回音。