如何向窗体添加函数


How to add a function to a form

>我有这样的表格:

$form  = '<form action="https://www.zarinpal.com/users/pay_invoice/'.$res.'"
method="post" target="_parent" ><input type="submit"  value="Buy"/></form>';
$form .= '</form>';
echo $form;

我想在此表单中添加一个功能,因此当单击"购买"时,在MySQL中会为此用户创建一个数据库,其中包含所选项目的信息和具有待处理交易状态的帐户ID,然后表单将他重定向到包含的网页。

我可以管理 MySQL 部分,但表单仅将用户重定向到给定的网页,并且我无法将用户信息添加到数据库中。

有没有办法为此用户添加数据库行,然后将他重定向到付款网页?(除了创建另一个页面)

<form action="https://www.zarinpal.com/users/pay_invoice/<?=$res ?> method="post" target="_parent" >
    <input type="test" name="customer-name" />
    <input type="submit"  value="Buy"/>
</form>

然后在目标页面上放置:

<?
print_r($_POST);
## That will let you know what is being posted from the form
?>

例如,要访问"客户名称"变量,只需执行以下操作:

$customerName = $_POST["customer-name"];