fork download
  1. <?php
  2. include('../includes/connect.php');
  3. if(isset($_POST['insert_product'])){
  4.  
  5. $product_title=$_POST['product_title'];
  6. $description=$_POST['description'];
  7. $product_keywords=$_POST['product_keywords'];
  8. $product_category=$_POST['product_category'];
  9. $product_brands=$_POST['product_brands'];
  10. $product_price=$_POST['product_price'];
  11. $product_status='true';
  12.  
  13. //accessing images
  14. $product_image1=$_FILES['product_image1']['name'];
  15. $product_image2=$_FILES['product_image2']['name'];
  16. $product_image3=$_FILES['product_image3']['name'];
  17. //accessing image tmp name
  18.  
  19. $temp_image1=$_FILES['product_image1']['tmp_name'];
  20. $temp_image2=$_FILES['product_image2']['tmp_name'];
  21. $temp_image3=$_FILES['product_image3']['tmp_name'];
  22.  
  23. //checking empty condition
  24. if($product_title=='' or $description=='' or $product_keywords=='' or $product_category=='' or $product_brands=='' or $product_price=='' or $product_image1=='' or $product_image2=='' or $product_image3==''){
  25. echo "<script>alert('please fill all the available fields')</script>";
  26. exit();
  27. }
  28. else{
  29.  
  30. move_uploaded_file($temp_image1,"./product_images/$product_image1");
  31. move_uploaded_file($temp_image2,"./product_images/$product_image2");
  32. move_uploaded_file($temp_image3,"./product_images/$product_image3");
  33.  
  34. //insert query
  35. $insert_products="insert into products (product_title,product_description,product_keywords,category_id,brand_id,product_image1,product_image2,product_image3,product_price,date,status) values ('$product_title','$description','$product_keywords','$product_category','$product_brands','$product_image1','$product_image2','$product_image3','$product_price',NOW(),'$product_status')";
  36. $result_query=mysqli_query($con,$insert_prodFILES);
  37. if($result_query){
  38. echo "<script>alert('successfully inserted the products')</script>";
  39. }
  40.  
  41. }
  42.  
  43.  
  44.  
  45. }
  46.  
  47. ?>
  48.  
  49.  
  50. <!DOCTYPE html>
  51. <html lang="en">
  52. <head>
  53. <meta charset="UTF-8">
  54. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  55. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  56. <title>Insert Product-Admin Dashboard</title>
  57. <!-- bootstrap css link -->
  58. <link href="https://c...content-available-to-author-only...r.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
  59. <!-- font awesome link -->
  60. <link rel="stylesheet" href="https://c...content-available-to-author-only...e.com/ajax/libs/font-awesome/6.3.0/css/all.min.css" integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
  61.  
  62. <!-- css file -->
  63. <link rel="stylesheet" href="style.css">
  64. </head>
  65. <body class="bg-light mt-3 w-50 m-auto">
  66. <div class="contianer">
  67. <h1 class="text-center">insert products</h1>
  68. <!-- title -->
  69. <form action="" method="post" enctype="multipart/from-data">
  70. <div class="from-outline mb-4">
  71. <label for="product_title" class="form-label text-center">Product title</label>
  72. <input type="text" name="product_title" id="product_title" class="form control" placeholder="Enter product title" autocomplete="off" required="required">
  73. </div>
  74.  
  75. <!-- description -->
  76. <form action="" method="post" enctype="multipart/from-data">
  77. <div class="from-outline mb-4">
  78. <label for="description" class="form-label text-center">Product description</label>
  79. <input type="text" name="description" id="description" class="form control" placeholder="Enter product description" autocomplete="off" required="required">
  80. </div>
Success #stdin #stdout #stderr 0.03s 26112KB
stdin
Standard input is empty
stdout
 
 
 <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Insert Product-Admin Dashboard</title>
    <!-- bootstrap css link -->
<link href="https://c...content-available-to-author-only...r.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<!-- font awesome link -->
<link rel="stylesheet" href="https://c...content-available-to-author-only...e.com/ajax/libs/font-awesome/6.3.0/css/all.min.css" integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />

<!-- css file -->
<link rel="stylesheet" href="style.css">
</head>
<body class="bg-light mt-3 w-50 m-auto">
    <div class="contianer">
        <h1 class="text-center">insert products</h1>
        <!-- title -->
        <form action="" method="post" enctype="multipart/from-data">
            <div class="from-outline mb-4">
                <label for="product_title" class="form-label text-center">Product title</label>
                <input type="text" name="product_title" id="product_title" class="form control" placeholder="Enter product title" autocomplete="off" required="required">
            </div> 

             <!-- description -->   
             <form action="" method="post" enctype="multipart/from-data">
            <div class="from-outline mb-4">
                <label for="description" class="form-label text-center">Product description</label>
                <input type="text" name="description" id="description" class="form control" placeholder="Enter product description" autocomplete="off" required="required">
            </div>
stderr
PHP Warning:  include(../includes/connect.php): failed to open stream: No such file or directory in /home/a3Bl0q/prog.php on line 2
PHP Warning:  include(): Failed opening '../includes/connect.php' for inclusion (include_path='.:/usr/share/php') in /home/a3Bl0q/prog.php on line 2