D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
G:
/
PleskVhosts
/
jhalakdembla.com
/
akkonlineservices.com
/
Admin
/
Coding
/
Filename :
updatecontroller.php
back
Copy
<?php require('db.php'); if(isset($_POST['submit'])){ $id = $_POST['id']; $CategoryId = $_POST['ctg']; $Title = $_POST['Prdtitle']; $mrp = $_POST['mrp']; $price = $_POST['price']; $_Image1 = $_POST['_Image1']; $_Image2 = $_POST['_Image2']; $_Image3 = $_POST['_Image3']; $_Image4 = $_POST['_Image4']; $file_name1=""; $file_name2=""; $file_name3=""; $file_name4=""; //------------img---1------------- $file_name1 = $_FILES['imgone']['name']; $file_tmp1 = $_FILES['imgone']['tmp_name']; if($file_name1 ==""){ $file_name1=$_Image1; } //------------img---2------------- $file_name2 = $_FILES['imgtwo']['name']; $file_tmp2 = $_FILES['imgtwo']['tmp_name']; if($file_name2 ==""){ $file_name2=$_Image2; } //------------img---3------------- $file_name3 = $_FILES['imgthree']['name']; $file_tmp3 = $_FILES['imgthree']['tmp_name']; if($file_name3 ==""){ $file_name3=$_Image3; } //------------img---4------------- $file_name4 = $_FILES['imgfour']['name']; $file_tmp4 = $_FILES['imgfour']['tmp_name']; if($file_name4 ==""){ $file_name4=$_Image4; } $description = $_POST['description']; // $InsertData = "INSERT INTO product (ProductCtgId,Title,Mrp,Price,Image1,Image2,Image3,Image4,Description) // VALUES ('$CategoryId','$Title','$mrp','$price','$file_name1','$file_name2','$file_name3','$file_name4','$description')"; $updateBlog = "UPDATE product SET ProductCtgId='$CategoryId',Title='$Title',Mrp='$mrp',Price='$price',Image1='$file_name1',Image2='$file_name2',Image3='$file_name3',Image4='$file_name4',Description='$description' WHERE id='$id'"; $res = mysqli_query($conn,$updateBlog); // Add the image to the "image" folder" if($res) { move_uploaded_file($file_tmp1,"../img/Productimg/".$file_name1); move_uploaded_file($file_tmp2,"../img/Productimg/".$file_name2); move_uploaded_file($file_tmp3,"../img/Productimg/".$file_name3); move_uploaded_file($file_tmp4,"../img/Productimg/".$file_name4); header('Location: ../AllProduct.php'); }else{ // header('Location: ../AdminPanel/allblog.php'); header('Location: ../AllProduct.php'); } } ?>