Skip to content
Advertisement

Select Value Did Not Enter Database after clicking post button

After clicking button submit, only select option of “type” is posted in the database, but select option of “Supplier” did not posted and only shows “0” values in phpMyAdmin.

Whenever I try to add a product, all the details are inputted to the database, but only “supplier” field is input with “0” Example of image is as below

Example of output: https://i.imgur.com/mKyZyLj.jpg

Below is my products.php

JavaScript

And below is my products_crud.php (which sends the data to database)

JavaScript

Advertisement

Answer

This

$stmt->bindParam(':supplier', $supplier, PDO::PARAM_INT);

an integer parameter binding, is not compatible with

JavaScript

which is of course a string

Additional note:

You dont have to do

JavaScript

Saves a bit of memory and a few CPU cycles

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement