Hello !
you have HTML errors :
don't use native keywords as 'name' or 'id',
see in your code :
name="submit"
name="img"
keep 'img' and 'submit' at their place, it's HTML keywords.
the DOM of the page is a lazy ( fast/multi-purposes ) engine, and your page is in bug. ( as the form part ).
another error :
when you enclose your 'submit button' with a link ( href= , the server have to send 2 page "../pro.php", then one another by php script. It's cycling and redundancy call of resources.
the use of the php 'header' is favorite for your need.
for your datas that are not handled,
the picture handling and the $_POST contents encounts a problem
make echo($_POST['cat']); to see if the datas reach the server.
It's debuging by tracing your vars.
few tricks and shorcuts for your php :
-------------
in your DB class :
*__construct
*_execute_query($the_query String){ ..... ; }
*_get_result_of_query($the_query String ){ .......;}
INSERT / UPDATE / DELETE don't return a collection; ( _execute_query ) : imperative
but SELECT query does retur a collection. ( _get_result_of_query ) : selective
It's two sided transactions. "come"/"go"
If you make one function for every query in your app, you'll have hundred miles DB class to write, really.
use String query as input ( for 2 functions only ).
------------------
$insertData = $Obj_pro->insertData($name, $price, $qty, $code, $cat, $file);
if ($insertData){
header("Location:../pro.php");
}else{
----
you can write : and gain less instructions to write to achieve
if( $Obj_pro->insertData($name, $price, $qty, $code, $cat, $file) ){
... it works; }