gpt4 book ai didi

php - 通知 : Undefined index, php

转载 作者:行者123 更新时间:2023-11-29 05:32:26 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
PHP: “Notice: Undefined variable” and “Notice: Undefined index”

我已经在 html 中创建了一个表单来创建发票,但是当我提交表单时收到以下通知:未定义索引:在/public_html/Bicycle Store/create_invoice.php第38行添加

我的绑定(bind)参数中缺少一个参数并修复了它,但我在提交时仍然收到通知。我检查了 php.net,但没有看到我的代码在哪里违反了语法。这是处理输入数据的 php 代码部分:

if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}

if( $_POST["add"] ) {

if (!($stmt = $mysqli->prepare("INSERT INTO INVOICE VALUES (?,?,?,?,?,?,?,?,?)"))) {
echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
}

if (!$stmt->bind_param("sssissddd", $_POST['fname'], $_POST['lname'], $_POST['phone'], $_POST['date'], $_POST['invoice_num'], $_POST['item_num'], $_POST['price'], $_POST['discount'], $_POST['total'])) {
echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
}

if (!$stmt->execute()) {
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
}

else {
printf("%d row inserted.<br/>", $stmt->affected_rows);
}

$stmt->close();
}

提前致谢!

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