使用 GET 方法将数据传递到另一个 php 文件


Passing data to another php file using GET method

我知道如何使用 Get 方法将数据传递到另一个页面作为 hiperlink:

{echo "<a  href=file.php?variable1=".$row['value1']."&variable2=".$row['value2']."'>Confirm</a>"; }

如何从上面这条车道的输入字段中增加价值?可能吗?

<input name="field_name"  type="text" >

试试这个方式:

{echo "<a  href=file.php?variable1=".$row['value1']."&variable2=".$row['value2']."&field_name=".$_GET['field_name']."'>Confirm</a>"; }
在这种情况下,

在 php 代码中使用 $_GET['field_name'] 来添加输入字段的值

例如:

<input name="field_name1"  type="text" >
<input name="field_name2"  type="text" >
{echo "<a  href=file.php?variable1=".$_GET['field_name1']."&variable2=".$_GET['field_name2']."'>Confirm</a>"; }

根据表单中 method 属性的值,输入的值将通过 $_POST$_GET 数组传递给 PHP。您可以通过以下代码将其链接到 PHP:

{echo "<a  href=file.php?variable1=".$_GET['field_name']."&variable2=".$row['value2']."'>Confirm</a>"; }
请注意,在

执行此代码之前,应先提交表单。如果这不可取,你可能应该使用 JavaScript。

{echo "<a  href=file.php?variable1=".$row['field_name']."&variable2=".$row['field_name_etc']."'>Confirm</a>"; }