$data = array();
$data['product_names'] = I('post.product_names');
$data['State'] = I('post.State');
$data['Remarks'] = I('post.Remarks');
$data['product_code'] = I('post.product_code');
$data['protection'] = I('post.protection');
$data['Selling_price'] = I('post.Selling_price');
$data['latest_cost'] = I('post.latest_cost');
$data['Tax'] = I('post.Tax');
$data['lowest_price'] = I('post.lowest_price');
$data['Stock'] = I('post.Stock');
$data['Packaging_unit'] = I('post.Packaging_unit');
$data['Weight'] = I('post.Weight');
$data['number_units'] = I('post.number_units');
$data['Specifications'] = I('post.Specifications');
$data['Packing_size'] = I('post.Packing_size');
$data['images'] = I('post.images');
$data['Brand'] = I('post.Brand');
$data['Product_class'] = I('post.Product_class');
$table = M("Product_name");
$tables = M('product_name_class');
if($data['typeid'] == '' || $data['typeid'] ==0){
$careid = $table->order('ID DESC')->limit(1)->getField('ID');
$data['typeid'] = ++$careid;
}
if($table.$tables->data($data)->filter('strip_tags')->add()){
$this->success('添加成功');
} else{
$this->error('添加失败');
}
}