如果(isset($_GET[';Confirm';]),我在这里做错了什么


What am I doing wrong here if(isset($_GET['Confirm']))?

My Get confirm没有触发查询?有人看到我做错了什么吗?

网址:http://www.example.co.uk/registerinterest.php?productid=125&confirm=Confirm

<div class="confirminterest">
     <form action="registerinterest.php?productid=' . $productid . '" method="post" enctype="multipart/form-data">
       <input name="confirm" type="submit" id="confirm" value="Confirm" />
     <input name="cancel" type="button" id="cancel" value="Cancel" /></form>
   </div>
 if (isset($_GET['Confirm'])) {
         $addinterest = mysql_query("INSERT INTO tm_credits_spent (fk_customer_id, fk_product_id, int_credits_spent) VALUES('$pid','$productid','$adminfee')") or die (mysql_error());
}

当表单使用POST方法时,您正在查找GET数据。由于要将数据插入数据库,POST是正确的,因此请将$_GET替换为$_POST

当您的按钮命名为confirm时,您也在查找Confirm。PHP是区分大小写的,所以也要替换它。

$_POST['confirm']

您似乎还面临SQL注入的风险。

添加我自己的答案,因为其他答案缺失,您的输入名称是"confirm",而不是"confirm"(这是它的值)。

因此,您必须检查isset()中的$_POST['confirm'],而不是$_POST['Confirm']$_GET['confirm']

您的表单发送的是POSTdata,而不是GET。更改表单的方法,或者检查$_POST['confirm']

您已经将方法设置为post。尝试使用$_POST['Confirm'];

GET字符串和表单(使用POST)中,字段都是"confirm",而不是"Confirm"。注意小写'c'

尝试:if (isset($_GET['confirm'])) {(或if (isset($_POST['confirm'])) {)。

您在html中使用php变量可能就是问题所在替换此;

<form action="registerinterest.php?productid=' . $productid . '" method="post" enctype="multipart/form-data">

带有

<form action="registerinterest.php?productid=' .<?php $productid ?>. '" method="post" enctype="multipart/form-data">

是的,使用CCD_ 18作为条件。