?> <table class="table table-stripped table-hover"> <tr> <th>Id</th> <th>Company Name</th> <th>contact Person</th> <th>Email</th> <th>Contact No</th> <th>Enquiry Date</th> <th>Subject</th> <th>Action</th> </tr> <?php $enquiry_repository = new EnquiryRepository(); foreach ($enquiry_repository->get_all() as $enq) { ?> <tr> <td><?php echo $enq->get_id(); ?> </td> <td><?php echo $enq->get_company_name(); ?> </td> <td><?php echo $enq->get_first_name(); ?> <?php
<?php include_once "../config.php"; include_once ROOT_PATH . "system/models/enquiry.class.php"; include_once ROOT_PATH . "system/repository/enquiry_repository.class.php"; $enquiry_repository = new EnquiryRepository(); if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == 'delete') { $enquiry_repository->delete($_GET['id']); header("location:index.php"); } ?> <?php include_once "../header.php"; ?> <?php if (isset($_GET['success']) && $_GET['success'] == "true") { ?> <div class="alert alert-success alert-dismissible fade in" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> <strong>Holy guacamole!</strong> Best check yo self, you're not looking too good. </div> <?php } ?> <div class="pull-right"> <a href="add.php" class="btn btn-primary">Add Enquiry</a> </div>
<?php include_once "../config.php"; include_once ROOT_PATH . "system/models/enquiry.class.php"; include_once ROOT_PATH . "system/repository/enquiry_repository.class.php"; if (!isset($_POST['submit'])) { header("location:index.php"); } $enquiry = new Enquiry(); $enquiry->set_company_name($_POST['company_name']); $enquiry->set_first_name($_POST['first_name']); $enquiry->set_last_name($_POST['last_name']); $enquiry->set_email($_POST['email']); $enquiry->set_contact_no($_POST['contact_no']); $enquiry->set_subject($_POST['subject']); $enquiry->set_message($_POST['message']); $enquiry->set_enquiry_date(date('Y-m-d H:i:s')); $enquiry_repository = new EnquiryRepository(); $result = 0; if (isset($_POST['id']) && $_POST['id'] == '') { $result = $enquiry_repository->insert($enquiry); } else { $enquiry->set_id($_POST['id']); $result = $enquiry_repository->update($enquiry); } if ($result > 0) { header("location:index.php?success=true"); } else { header("location:add.php?error=true"); } exit;