aahhhh so confusing. So when I just do one set, with just a set of product_1_name, product_1_price, product_1_quantity the script works fine! it adds 5 as the product id and everything else is added to the database fine. The other spots are left as null.
However, when I add the other variables i.e. products 1 to 7 all at once, the script doesnt execute! the database stays empty and doesnt add to the table. Ive spent 2 hours checking for syntax errors but couldnt find typos. Is this related to the number of items you can add at one?
$a = 5;
$productid = $a;
    $product_1_name = mysqli_real_escape_string($conn, $_POST['product_1_name']);   //uid
    $product_1_price = mysqli_real_escape_string($conn, $_POST['product_1_price']); //uid
    $product_1_quantity = mysqli_real_escape_string($conn, $_POST['product_1_quantity']);   //uid
    $product_2_name = mysqli_real_escape_string($conn, $_POST['product_2_name']);   //uid
    $product_2_price = mysqli_real_escape_string($conn, $_POST['product_2_price']); //uid
    $product_2_quantity = mysqli_real_escape_string($conn, $_POST['product_2_quantity']);   //ui3
    $product_3_name = mysqli_real_escape_string($conn, $_POST['product_3_name']);   //uid
    $product_3_price = mysqli_real_escape_string($conn, $_POST['product_3_price']); //uid
    $product_3_quantity = mysqli_real_escape_string($conn, $_POST['product_3_quantity']);   //uid
    $product_4_name = mysqli_real_escape_string($conn, $_POST['product_4_name']);   //uid
    $product_4_price = mysqli_real_escape_string($conn, $_POST['product_4_price']); //uid
    $product_4_quantity = mysqli_real_escape_string($conn, $_POST['product_4_quantity']);   //uid
    $product_5_name = mysqli_real_escape_string($conn, $_POST['product_5_name']);   //uid
    $product_5_price = mysqli_real_escape_string($conn, $_POST['product_5_price']); //uid
    $product_5_quantity = mysqli_real_escape_string($conn, $_POST['product_5_quantity']);   //uid
    $product_6_name = mysqli_real_escape_string($conn, $_POST['product_6_name']);   //uid
    $product_6_price = mysqli_real_escape_string($conn, $_POST['product_6_price']); //uid
    $product_6_quantity = mysqli_real_escape_string($conn, $_POST['product_6_quantity']);   //uid
    $product_7_name = mysqli_real_escape_string($conn, $_POST['product_7_name']);   //uid
    $product_7_price = mysqli_real_escape_string($conn, $_POST['product_7_price']); //uid
    $product_7_quantity = mysqli_real_escape_string($conn, $_POST['product_7_quantity']);   //uid
        $sql = "INSERT INTO products (userid, productname, venue, date, productdescription, name) VALUES ('$userid','$productname', '$venue', '$date', '$productdescription', '$name');";
        mysqli_query($conn, $sql);
        $sql = "INSERT INTO productproducts (productid, product_1_name, product_1_price, product_1_quantity, 
                            product_2_name, product_2_price, product_2_quantity, 
                            product_3_name, product_3_price, product_3_quantity, 
                            product_4_name, product_4_price, product_4_quantity, 
                            product_5_name, product_5_price, product_5_quantity, 
                            product_6_name, product_6_price, product_6_quantity, 
                            product_7_name, product_7_price, product_7_quantity) 
                            VALUES (
                            '$productid','$product_1_name', '$product_1_price', '$product_1_quantity',
                            '$product_2_name', '$product_2_price', '$product_2_quantity', 
                            '$product_3_name', '$product_3_price', '$product_3_quantity', 
                            '$product_4_name', '$product_4_price', '$product_4_quantity',  
                            '$product_5_name', '$product_5_price', '$product_5_quantity', 
                            '$product_6_name', '$product_6_price', '$product_6_quantity', 
                            '$product_7_name', '$product_7_price', '$product_7_quantity' 
                            );";
        mysqli_query($conn, $sql);
        header("Location: ../members.php?product=success");
        exit();
} else {
    header("Location: ../signup.php");
    exit();
}
?>
Code I used to make database:
CREATE TABLE productevents (
    o_id int(11) not null AUTO_INCREMENT PRIMARY KEY,
    productid int(11),
    product_1_name varchar(256),
    product_1_price int(11),
    product_1_quantity int(11),
    product_2_name varchar(256),
    product_2_price int(11),
    product_2_quantity int(11),
    product_3_name varchar(256),
    product_3_price int(11),
    product_3_quantity int(11),
    product_4_name varchar(256),
    product_4_price int(11),
    product_4_quantity int(11),
    product_5_name varchar(256),
    product_5_price int(11),
    product_5_quantity int(11),
    product_6_name varchar(256),
    product_6_price int(11),
    product_6_quantity int(11),
    product_7_name varchar(256),
    product_7_price int(11),
    product_7_quantity int(11)
);
echosql result:
Notice: Undefined index: product_3_name in website.xx.xxon line 29
Notice: Undefined index: product_3_price in website.xx.xxon line 30
Notice: Undefined index: product_3_quantity in website.xx.xxon line 31
Notice: Undefined index: product_4_name in website.xx.xxon line 33
Notice: Undefined index: product_4_price in website.xx.xxon line 34
Notice: Undefined index: product_4_quantity in website.xx.xxon line 35
Notice: Undefined index: product_5_name in website.xx.xxon line 37
Notice: Undefined index: product_5_price in website.xx.xxon line 38
Notice: Undefined index: product_5_quantity in website.xx.xxon line 39
Notice: Undefined index: product_6_name in website.xx.xxon line 41
Notice: Undefined index: product_6_price in website.xx.xxon line 42
Notice: Undefined index: product_6_quantity in website.xx.xxon line 43
Notice: Undefined index: product_7_name in website.xx.xxon line 45
Notice: Undefined index: product_7_price in website.xx.xxon line 46
Notice: Undefined index: product_7_quantity in website.xx.xxon line 47
INSERT INTO productevents (productid, product_1_name, product_1_price, product_1_quantity, product_2_name, product_2_price, product_2_quantity, product_3_name, product_3_price, product_3_quantity, product_4_name, product_4_price, product_4_quantity, product_5_name, product_5_price, product_5_quantity, product_6_name, product_6_price, product_6_quantity, product_7_name, product_7_price, product_7_quantity) VALUES ( '5','product1', '1', '1', 'product2', '2', '2', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' );
 
     
     
    