如何使用 php 在 html 中获取输入名称中的值


How to get the value inside a input name in html using php

我想知道如何使用 php 获取输入标签中名称的值?

<input type="text name="x" value="myFunction(this.name)">

它应该返回名称标签 x 的值我不确定语法"this"是否会获得名称标签的值,即 x。

为了在PHP中获取值,您必须制作表单,示例

<form action="" method="post">
<input type="text" name="field">
<input type="submit" name="submit" value="Submit">
</form>

然后通过PHP的post方法你可以得到值。例:

 <?php 
 echo $_POST['field'];
 ?>