Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

product edit page not work #15

Open
TurkAndroid opened this issue Aug 23, 2020 · 2 comments
Open

product edit page not work #15

TurkAndroid opened this issue Aug 23, 2020 · 2 comments

Comments

@TurkAndroid
Copy link

Product edit page does not work. Only the product image modification part is visible, the other tab is not visible.

@rlphpm
Copy link

rlphpm commented Sep 26, 2020

Product edit page does not work. Only the product image modification part is visible, the other tab is not visible.

True, you cant add a product from the browser.
I have tried, only in vain, unless you add the product manually from the database.

change the $url so that it can be uploaded to the right folder.
code:

if($_POST) {

$productName 		= $_POST['productName'];

// $productImage = $_POST['productImage'];
$quantity = $_POST['quantity'];
$rate = $_POST['rate'];
$brandName = $_POST['brandName'];
$categoryName = $_POST['categoryName'];
$productStatus = $_POST['productStatus'];

$type = explode('.', $_FILES['productImage']['name']);
$type = $type[count($type)-1];		
$url = '../assests/images/'.uniqid(rand()).'.'.$type;
if(in_array($type, array('gif', 'jpg', 'jpeg', 'png', 'JPG', 'GIF', 'JPEG', 'PNG'))) {
	if(is_uploaded_file($_FILES['productImage']['tmp_name'])) {			
		if(move_uploaded_file($_FILES['productImage']['tmp_name'], $url)) {
			
			$sql = "INSERT INTO product (product_name, product_image, brand_id, categories_id, quantity, rate, active, status) 
			VALUES ('$productName', '$url', '$brandName', '$categoryName', '$quantity', '$rate', '$productStatus', 1)";

			if($connect->query($sql) === TRUE) {
				$valid['success'] = true;
				$valid['messages'] = "Successfully Added";	
			} else {
				$valid['success'] = false;
				$valid['messages'] = "Error while adding the members";
			}

		}	else {
			return false;
		}	// /else	
	} // if
} // if in_array 		

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@TurkAndroid @rlphpm and others