gpt4 book ai didi

php - HTML 表单提交后的 POST 数据为空,虽然请求类型是 POST

转载 作者:行者123 更新时间:2023-11-28 05:12:58 34 4
gpt4 key购买 nike

<分区>

因此,我尝试将一些数据从 HTML 表单发布到 PHP 脚本。这是我正在使用的表格:

<form style="border: 1px solid black; border-radius: 5px; padding: 10px;" action="order2.php" method="post">
<div class="form-group">
<label>Service Type</label>
<select class="form-control" id="service">
<?php
$sql = "SELECT name FROM services ORDER BY name ASC";
$statement = $mysqli->prepare($sql);
$statement->execute();
$statement->store_result();

$result = get_result($statement);

while($data = array_shift($result)) {
echo('<option>'.$data['name'].'</option>');
}
?>
</select>
<small id="serviceHelp" class="form-text text-muted"></small>
</div>

<div class="form-group">
<label>Amount</label>
<input type="number" class="form-control" id="amount" placeholder="1000">
<small id="priceHelp" class="form-text text-muted"></small>
</div>

<div class="form-group">
<label>Link</label>
<input type="text" class="form-control" id="link" placeholder="">
<small id="linkHelp" class="form-text text-muted"><strong>Warning</strong>! Please keep to the format of the example provided!</small>
</div>

<div class="form-group">
<label>e*pvp Username</label>
<input type="text" class="form-control" id="username" placeholder="i0N">
<small id="linkHelp" class="form-text text-muted"><strong>Warning</strong>! Please make sure your username is correct (copy & paste it), because the payment will fail otherwise!</small>
</div>

<div style="text-align: center;"><button type="submit" class="btn btn-danger" style="padding-left: 30px; padding-right: 30px;">Submit</button></div>
</form>

正如您在最顶部看到的,“方法”设置为“发布”。表单成功重定向了我,当我通过检查器查看请求时,它还显示发出了 POST 请求。但是,没有任何数据通过。如果我尝试 var_dump($_POST);,它也只显示 array(0) { }。我错过了什么?

提交表单时,我的 error_log 中也永久出现了这个 PHP 错误:

[30-Jul-2018 04:14:28 America/New_York] PHP Notice:  Undefined index: service in /home/maxkygbx/public_html/epvpsocial/order2.php on line 6
[30-Jul-2018 04:14:28 America/New_York] PHP Notice: Undefined index: service in /home/maxkygbx/public_html/epvpsocial/order2.php on line 7

这是相应的行:

<?php
if(is_null($_POST['service']) || $_POST['service'] == ""){
echo($_POST['service']);
die();
}

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com