ok
Direktori : /home/u243902267/domains/holyhimalayayatra.com/public_html/admin/ |
Current File : /home/u243902267/domains/holyhimalayayatra.com/public_html/admin/add-trekking.php |
<?php include('include/header.php'); include('include/sidebar.php'); if (isset($_POST['submit'])) { $title=$_POST['title']; $description=$_POST['description']; $image = $_FILES['image']['name']; $path = 'uploads/'.time().$image; $sql = $conn->query("INSERT INTO trekking(title,image,description) VALUES('$title','$path','$description')"); $trekking_id = $conn->insert_id; for($i=0;$i<count($_POST['ques']);$i++){ $ques=$_POST['ques'][$i]; $ans=$_POST['ans'][$i]; $sql = $conn->query("INSERT INTO itenary(trekking_id,ques,ans) VALUES ('$trekking_id','$ques','$ans')"); } if ($sql) { move_uploaded_file($_FILES['image']['tmp_name'], $path); echo '<script>alert("Save Changes Successfully");location.href="trekking";</script>'; } else { echo '<script>alert("Something Wrong");</script>'; } } ?> <!--start content--> <main class="page-content"> <div class="row"> <div class="col-12 col-lg-8"> <div class="card shadow-sm border-0"> <div class="card-body"> <h5 class="mb-0">Add Trekking</h5> <hr> <div class="card shadow-none border"> <div class="card-header"> <h6 class="mb-0 text-uppercase">Add Trekking</h6> </div> <div class="card-body"> <form class="row g-3" method="post" enctype="multipart/form-data"> <div class="col-md-6"> <label class="form-label">Title</label> <input type="text" class="form-control" name="title" required> </div> <div class="col-md-6"> <label class="form-label">Image</label> <input type="file" class="form-control" onchange="readURL(this);" name="image" accept="image/*"> </div> <div class="col-md-12"> <label class="form-label">Description</label> <textarea class="form-control" rows="5" cols="5" placeholder="Write..." name="description" id="editor"></textarea> </div> <div class="col-md-6"> <h3>Itenary</h3> </div> <div class="col-md-6 text-end"> <button id="btn1" type="button" class="btn btn-primary px-4">Add More Intenary</button> </div> <div class="col-md-12"> <label class="form-label">Itenary</label> <input type="text" class="form-control rounded-0 mb-1" placeholder="Write" name="ques[]"> <textarea class="form-control" rows="5" cols="5" placeholder="Write..." name="ans[]" id="text_editor"></textarea> </div> <div class="itenary"></div> <div class="col-md-6"> <button type="submit" class="btn btn-primary px-4" name="submit" value="1">Save Changes</button> </div> </form> </div> </div> </div> </div> </div> <div class="col-12 col-lg-4"> <div class="card shadow-sm border-0 overflow-hidden"> <div class="card-body"> <div class="profile-avatar text-center"> <img id="preview" src="assets/images/dummy.jpg" class="shadow w-100"> </div> </div> </div> </div> </div><!--end row--> </main> <!--end page main--> <?php include('include/footer.php');?>