MMCT TEAM
Server IP : 62.72.28.201  /  Your IP : 3.144.40.216
Web Server : LiteSpeed
System : Linux in-mum-web1113.main-hosting.eu 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : u249650955 ( 249650955)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : ON
Directory (0755) :  /home/u249650955/domains/ladyflorencepublicschool.com/public_html/admin_area/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u249650955/domains/ladyflorencepublicschool.com/public_html/admin_area/insert_syllabus.php
<!DOCTYPE>
<?php
    include("includes/db.php");
    $sql="select * from class_categories";
    $res=mysqli_query($con, $sql);
?>
<html>
    <head>
        <title>Inserting Product</title>
    </head>
    <body>
        <form action="insert_syllabus.php" method="post" enctype="multipart/form-data">
            <table align="center" width="100%" border="2" bgcolor="orange">
                <tr align="center">
                    <td colspan="8"><h2 style="padding:10px;">Insert New Syllabus Here</h2></td>
                </tr>
                <tr>
                    <td align="center"><b>Select Class</b></td>
                    <td align="center">
                        <select name="cat_id">
                            <option value=""></option>
                            <?php
                                while ($row=mysqli_fetch_assoc($res)) {
                            ?>
                                <option value="<?php echo $row['cat_id'] ?>"><?php echo $row['cat_title'] ?></option>
                            <?php } ?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td align="center"><b>Syllabus Title :</b></td>
                    <td align="center"><input type="text" name="notic_title"></td>
                </tr>
                <tr>
                    <td align="center"><b>Add PDF :</b></td>
                    <td align="center"><input type="file" name="product_image" required></td>
                </tr>
                <tr align="center">
                    <td colspan="8"><input type="submit" name="insert_post" value="Insert Syllabus" class="btn"></td>
                </tr>
            </table>
        </form>
        <style>
            td input{
                width: 90%;
                padding: 5px;
                margin: 5px;
            }
            td select{
                 width: 90%;
                padding: 5px;
                margin: 5px;
            }
            .img-type{
                padding: 5px;
                border-radius: 10px;
            }
            .btn{
                width: 30%;
                cursor: pointer;
                background: #0009;
                color: #fff;
                padding: 10px;
            }
            .btn:hover{
                background: blue;
            }
            .decri{
                border-radius: 8px;
                resize: none;
            }
        </style>
    </body>
</html>
<?php
  //getting the text data from the fields
    if(isset($_POST['insert_post'])){
        $cat_id = $_POST['cat_id'];
        $notic_title = $_POST['notic_title'];
        //getting the image from the field
        $product_image = $_FILES['product_image']['name'];
        $product_image_tmp = $_FILES['product_image']['tmp_name'];
        
        move_uploaded_file($product_image_tmp,"product_images/$product_image");
        
        $insert_product = "insert into syllabus (cat_id,s_title,s_pdf) value ('$cat_id','$notic_title','$product_image')";
        $insert_pro = mysqli_query($con, $insert_product);
        if($insert_pro){
            echo "<script>alert('Syllabus Has been inserted!')</script>";
            echo "<script>window.open('index.php?insert_syllabus','_self')</script>";
        }
    }
?>

MMCT - 2023