<?php
if (isset($_POST['post']))
{
// text data variables
$title = $_POST['title'];
$disc = $_POST['disc'];
// image name
$post_img = $_FILES['post_img'] ['name'];
//images temp names
$temp_img = $_FILES['post_img'] ['tmp_name'];
if ($title=='' OR $disc=='' OR $post_img=='') {
echo "<script>alert('Please fill all the fields')</script>";
exit();
}
else
{
// insert uploading images in imag folder
move_uploaded_file($temp_img, "post_img/$post_img");
$insert_product = "insert into products (post_id,title,disc,post_img) values ('$post_id','$title','$disc','$post_img')";
$run_product = mysqli_query($con, $insert_product);
if ($run_product)
{
echo "<script>alert('Product successfullt insert')</script>";
}
?>
Asked
Active
Viewed 33 times
0

Narendrasingh Sisodia
- 21,247
- 6
- 47
- 54

Brijmohan Sharma
- 1
- 1
-
1You are missing two closing braces `}` at the end of your code. – Finwe Aug 26 '17 at 07:25
-
What @Finwe said. – Wayne Aug 26 '17 at 08:31