File "gallery-add.php"

Full path: /home/fsibplc/public_html/localhost/admin/gallery-add.php
File size: 6.37 B (6.37 KB bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php

include('config/dbcon.php');
include('authentication.php');
//session_start();

include('include/header.php');
 

?>

<div class="container-fluid px-4">

    <div class="row mt-4">
        <div class="col-md-12">
            <?php include('message.php'); ?>
            <div class="card">
                <div class="card-header">
                    <h4>Add to Gallery<a href="gallery-view.php?id=<?= htmlspecialchars($_GET['id']) ?>"
                            class="btn btn-danger float-end">Back</a></h4>

                </div>
                <div class="card-body">

                    <form action="code.php" method="POST" enctype="multipart/form-data">

                        <div class="row">

                            <div class="col-md-6 md-3">
                                <label for="">Gallery Name</label>

                                <?php  $id= intval($_GET['id']);
                                        $category = "SELECT * from categories WHERE status ='0' and category_type='gallery'";
                                        $category_run = mysqli_query($con, $category);

                                        if(mysqli_num_rows($category_run) > 0 )
                                        {
                                            ?>
                                <select name="category_id" required class="form-control">
                                    <option value="">--Select Category--</option>
                                    <?php 
                                                foreach($category_run as $categoryitem)
                                                { 
                                                ?>
                                    <option value="<?=$categoryitem['id']; ?>"
                                        <?= $categoryitem['id']==$id ? 'selected':''?>><?=$categoryitem['name']; ?>
                                    </option>
                                    <?php
                                                } 
                                                ?>

                                </select>
                                <?php     
                                        }else{

                                        }
                                    ?>

                            </div>


                            <?php     //custom field for different category gallery
                                    $category_id = intval($_GET['id']);
                                    $query = "SELECT name FROM categories Where id = '$category_id'";
                                    $query_run = mysqli_query($con, $query);
                                    $result = mysqli_fetch_array($query_run);
                                     
                                if($result[0] == 'Testimonial'){
                                  ?>
                            <div class="col-md-6 md-3">
                                <label for="">Name</label>
                                <input type="text" name="field_1" required class="form-control">
                            </div>
                            <div class="col-md-6 md-3">
                                <label for="">Profession</label>
                                <input type="text" name="field_2" required class="form-control">
                            </div>
                            <div class="col-md-6 md-3">
                                <label for="">Star</label>
                                <input type="number" name="field_3" required class="form-control">
                            </div>
                            <div class="col-md-6 md-3">
                                <label for="">Saysting</label>
                                <input type="text" name="field_4" required class="form-control">
                            </div>
                            <?php }elseif($result[0] == 'Team'){?>

                            <div class="col-md-6 md-3">
                                <label for="">Name</label>
                                <input type="text" name="field_1" required class="form-control">
                            </div>
                            <div class="col-md-6 md-3">
                                <label for="">Designation</label>
                                <input type="text" name="field_2" required class="form-control">
                            </div>
                            <div class="col-md-6 md-3">
                                <label for="">Social Id</label>
                                <input type="text" name="field_3" required class="form-control">
                            </div>
                             



                            <?php }else{ //default field for gallery?>



                            <div class="col-md-6 md-3">
                                <label for="">Title</label>
                                <input type="text" name="field_1" required class="form-control">
                            </div>
                            <div class="col-md-6 md-3">
                                <label for="">Sub Title</label>
                                <input type="text" name="field_2" required class="form-control">
                            </div>




                            <?php } ?>


                            <div class="col-md-6 md-3">
                                <label for="">Image</label>

                                <input type="file" name="image" required class="form-control">
                            </div>


                            <input type="hidden" name="author" value="<?= $_SESSION['auth_user']['user_name'];?>" />


                            <div class="col-md-6 md-3">
                                <label for="Status">Status</label>
                                <input type="checkbox" name="status" width="70px" height="70px" />
                                Checked = Hidden, Unchecked = Visible
                            </div>
                            <div class="col-md-6 md-3">
                                <button type="submit" class="btn btn-primary" name="gallery_add">Save Gallery
                                    Image</button>
                            </div>

                        </div>
                    </form>







                </div>
            </div>

        </div>

    </div>
</div>

<?php
include('include/footer.php');

include('include/script.php');

?>