fixed array index error on addMaterial.php