• File: createBrand.php
  • Full Path: /home/dealkatnwc/www/GARAGE/php_action/createBrand.php
  • Date Modified: 12/11/2023 3:34 PM
  • File size: 682 bytes
  • MIME-type: text/x-php
  • Charset: utf-8
<?php 	

require_once 'core.php';

$valid['success'] = array('success' => false, 'messages' => array());

if($_POST) {	

	$brandName = $_POST['brandName'];
  $brandStatus = $_POST['brandStatus']; 

	$sql = "INSERT INTO brands (brand_name, brand_active, brand_status) VALUES ('$brandName', '$brandStatus', 1)";

	if($connect->query($sql) === TRUE) {
	 	$valid['success'] = true;
		$valid['messages'] = "Successfully Added";
		header('location:fetchBrand.php');	
	}  
	  
     else {
	 	$valid['success'] = false;
	 	$valid['messages'] = "Error while adding the members";
	 	header('location:../add-brand.php');
	}
	 

	$connect->close();

	echo json_encode($valid);
 
} // /if $_POST