0
<?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>";
        }











?>
Narendrasingh Sisodia
  • 21,247
  • 6
  • 47
  • 54

0 Answers0