Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8904787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:13:32+00:00 2026-06-15T02:13:32+00:00

Possible Duplicate: PHP: Notice: Undefined variable and Notice: Undefined index I’ve created a form

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:13:33+00:00Added an answer on June 15, 2026 at 2:13 am

    Replace

    if( $_POST["add"] ) {
    

    with

    if( isset($_POST["add"]) /* and other condition on $_POSt["add"] if necessary */) {
    

    Problem is that you are accessing “add” key in your post array and it is not there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: PHP: Notice: Undefined variable and Notice: Undefined index In html code: <select
Possible Duplicate: PHP: Notice: Undefined variable and Notice: Undefined index i am getting ranksection
Possible Duplicate: PHP: “Notice: Undefined variable” and “Notice: Undefined index” I am getting warnings.
Possible Duplicate: PHP: Notice: Undefined variable and Notice: Undefined index im trying to create
Possible Duplicate: PHP: “Notice: Undefined variable” and “Notice: Undefined index” This is strange but
Possible Duplicate: PHP: “Notice: Undefined variable” and “Notice: Undefined index” This code shows warnings
Possible Duplicate: PHP: Notice: Undefined variable and Notice: Undefined index I know its basic
Possible Duplicate: PHP: Notice: Undefined variable and Notice: Undefined index I am just learning
Possible Duplicate: PHP: Notice: Undefined variable and Notice: Undefined index Reference - What does
Possible Duplicate: PHP: Notice: Undefined variable and Notice: Undefined index I want when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.