Possible Duplicate:
PHP: “Notice: Undefined variable” and “Notice: Undefined index”
I've created a form in html to create an invoice, but I'm getting the following notice when I submit my form: Undefined index: add in /public_html/Bicycle Store/create_invoice.php on line 38
I had a missing parameter in my binding parameters and fixed it, but I'm still getting the notice when I submit. I checked php.net, but I'm not seeing where my code violates the syntax. Here's the php section of code that processes the inputted data:
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();
}
Thanks in advance!