我正試圖在mysql數據庫中創建一個訂閱條目。每次我提交表單時,都會創建一個新條目,而電子郵件地址或輸入值不會顯示在數據庫中。 請找出有什麼問題。表單的輸入沒有更新
<?php
include 'dbh.php';
$subs=$_POST['$sub_email']:
$sql="INSERT INTO subscribe(sub) VALUES('$subs')";
$result=mysqli_query($conect,$sql);
header("Location:index.html");
?>
<form class="form" method="post" action="subscribe.php" style="margin-top: 20px">
<div class="input-group">
<div class="input-group-addon">@</div>
<input type="email" class="form-control" name="subs_email" id="inlineFormInputGroup" placeholder="Your Email">
</div>
<button type="submit" class="btn btn-success btn-lg" style="margin-top:5px " >Submit</button>
</form>
**警告**:當使用g'mysqli'你應該使用[參數化查詢](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php)和['bind_param'](http://php.net/ manual/en/mysqli-stmt.bind-param.php)將用戶數據添加到您的查詢中。 **不要**使用字符串插值或連接來完成此操作,因爲您創建了嚴重的[SQL注入漏洞](http://bobby-tables.com/)。 **絕不**將'$ _POST'或'$ _GET'數據直接放入查詢中,如果有人試圖利用您的錯誤,這會非常有害。 – tadman