Jump to content

DanEthical

Members
  • Posts

    112
  • Joined

  • Last visited

About DanEthical

  • Birthday 02/12/1971

Profile Information

  • Gender
    Male
  • Location
    Victoria, Australia
  • Age
    50

Recent Profile Visitors

1,600 profile views

DanEthical's Achievements

Advanced Member

Advanced Member (4/5)

2

Reputation

3

Community Answers

  1. I see. Oh well. Not a biggie. Just wanted it displayed in the booking table on the site so end user can see which tour was booked. Thanks as always for your help. Always appreciated.
  2. Working now. I am getting the ID now into the tour_id but also into the tour_name field. I need tour_name to go into tour_name. if(isset($_POST['new']) && $_POST['new']==1){ $tour_id = mysqli_real_escape_string($con, $_POST['tour_name']); $tour_name = mysqli_real_escape_string($con, $_POST['tour_name']); $customer_name = mysqli_real_escape_string($con, $_POST['customer_name']); $customer_address = mysqli_real_escape_string($con, $_POST['customer_address']); $customer_email = mysqli_real_escape_string($con, $_POST['customer_email']); $customer_phone = mysqli_real_escape_string($con, $_POST['customer_phone']); $total_pax = mysqli_real_escape_string($con, $_POST['total_pax']); $status = mysqli_real_escape_string($con, $_POST['status']); $order_at = mysqli_real_escape_string($con, date("Y-m-d H:i:s")); $total_amount = mysqli_real_escape_string($con, $_POST['total_amount']); $query="insert into bookings (`tour_id`, `tour_name`, `customer_name`, `customer_address`, `customer_email`, `customer_phone`, `total_pax`, `status`, `order_at`, `total_amount`)values ('$tour_id', '$tour_name', '$customer_name', '$customer_address', '$customer_email', '$customer_phone', '$total_pax', '$status', '$order_at', '$total_amount')"; mysqli_query($con,$query) or die(mysqli_error($con)); if(mysqli_affected_rows($con)== 1 ){ $message = '<p class="text-success"><i class="fa fa-check"></i> - Record Inserted Successfully</p>'; } }
  3. I call it Irish Brain Syndrome. Here is the fill add-booking.php <?php include_once('includes/header.php'); if(isset($_POST['new']) && $_POST['new']==1){ $sql = "SELECT id FROM jobs"; $result = $con->query($sql); while(list($id) = mysqli_fetch_row($result)){ } $tour_id = isset($_GET['id']) ? $_GET['id'] : ''; $tour_name = mysqli_real_escape_string($con, $_POST['tour_name']); $customer_name = mysqli_real_escape_string($con, $_POST['customer_name']); $customer_address = mysqli_real_escape_string($con, $_POST['customer_address']); $customer_email = mysqli_real_escape_string($con, $_POST['customer_email']); $customer_phone = mysqli_real_escape_string($con, $_POST['customer_phone']); $total_pax = mysqli_real_escape_string($con, $_POST['total_pax']); $status = mysqli_real_escape_string($con, $_POST['status']); $order_at = mysqli_real_escape_string($con, date("Y-m-d H:i:s")); $total_amount = mysqli_real_escape_string($con, $_POST['total_amount']); $query="insert into bookings (`tour_id`, `tour_name`, `customer_name`, `customer_address`, `customer_email`, `customer_phone`, `total_pax`, `status`, `order_at`, `total_amount`)values ('$tour_id', '$tour_name', '$customer_name', '$customer_address', '$customer_email', '$customer_phone', '$total_pax', '$status', '$order_at', '$total_amount')"; mysqli_query($con,$query) or die(mysqli_error($con)); if(mysqli_affected_rows($con)== 1 ){ $message = '<p class="text-success"><i class="fa fa-check"></i> - Record Inserted Successfully</p>'; } } ?> <!-- Header--> <div class="breadcrumbs"> <div class="col-sm-4"> <div class="page-header float-left"> <div class="page-title"> <h1>Bookings</h1> </div> </div> </div> <div class="col-sm-8"> </div> </div> <div class="content mt-3"> <div class="animated fadeIn"> <div class="row"> <div class="col-lg-12"> <div class="card"> <div class="card-header"><strong>Add </strong><small>Booking <?php if($message = isset($message) ? $message : ''){ printf($message); } ?></small></div> <div class="card-body card-block"> <form role="form" method="post" name="add_tour" id="add_tour" action"" > <input type="hidden" name="new" value="1" /> <div class="modal-body"> <div class="row form-group"> <div class="col-6"> <div class="form-group"><label for="customer_name" class=" form-control-label">Customer Name</label><input type="text" id="customer_name" name="customer_name" placeholder="Customer Name" class="form-control"> </div> </div> <div class="col-6"> <div class="form-group"><label for="customer_address" class=" form-control-label">Customer Address</label> <input type="text" class="form-control" id="customer_address" name="customer_address" placeholder="Customer's Address" > </div> </div> </div> <div class="row form-group"> <div class="col-6"> <div class="form-group"><label for="total_pax" class=" form-control-label">Pax</label> <input type="text" id="total_pax" name="total_pax" placeholder="How many passengers?" class="form-control"> </div> </div> <div class="col-6"> <div class="form-group"><label for="total_amount" class=" form-control-label">Price</label><input type="text" id="total_amount" name="total_amount" placeholder="0.00" class="form-control"> </div> </div> </div> <div class="row form-group"> <div class="col-6"> <div class="form-group origin" ><label for="customer_email" class=" form-control-label">Customer Email</label><input type="email" id="customer_email" name="customer_email" placeholder="Customer Email" class="form-control"></div> </div> <div class="col-6"> <div class="form-group"><label for="customer_phone" class=" form-control-label">Customer Phone</label><input type="phone" id="customer_phone" name="customer_phone" placeholder="Customer Phone" class="form-control"></div> </div> </div> <div class="row form-group"> <div class="col-6"> <div class="form-group origin" ><label for="status" class=" form-control-label">Payment Status</label> <select class="form-control" id="status" name="status"> <option value =""> == Choose One ==</option> <option value="PAID">PAID</option> <option value="UNPAID">UNPAID</option> </select> </div> </div> <div class="col-6"> <div class="form-group"><label for="tour_name" class=" form-control-label">Tour or Charter</label> <select class="form-control" id="tour_name" name="tour_name"> <option value="Select">== Select Tour or Charter ==</option> <?php $sql = "SELECT name, id FROM jobs"; $result = $con->query($sql); while(list($id, $name) = mysqli_fetch_row($result)){ ?> <option value="<?php echo $id ?>"><?php echo $name;?></option> <?php } ?> </select> </div> </div> </div> <div class="modal-footer"> <button type="reset" class="btn btn-warning">Clear Form</button> <button type="submit" name="submit" id="submit" class="btn btn-primary">Confirm</button> </div> </form> </div> </div> </div><!-- .animated --> </div><!-- .content --> </div><!-- /#right-panel --> <!-- Right Panel --> <script src="assets/js/vendor/jquery-2.1.4.min.js"></script> <script src="assets/js/popper.min.js"></script> <script src="assets/js/plugins.js"></script> <script src="assets/js/main.js"></script> <script src="assets/js/bing.js"></script> <script src="assets/js/lib/data-table/datatables.min.js"></script> <script src="assets/js/lib/data-table/dataTables.bootstrap.min.js"></script> <script src="assets/js/lib/data-table/dataTables.buttons.min.js"></script> <script src="assets/js/lib/data-table/buttons.bootstrap.min.js"></script> <script src="assets/js/lib/data-table/jszip.min.js"></script> <script src="assets/js/lib/data-table/pdfmake.min.js"></script> <script src="assets/js/lib/data-table/vfs_fonts.js"></script> <script src="assets/js/lib/data-table/buttons.html5.min.js"></script> <script src="assets/js/lib/data-table/buttons.print.min.js"></script> <script src="assets/js/lib/data-table/buttons.colVis.min.js"></script> <script src="assets/js/lib/data-table/datatables-init.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script src="https://cdn.tiny.cloud/1/sw6bkvhzd3ev4xl3u9yx3tzrux4nthssiwgsog74altv1o65/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script> </body> </html>
  4. Ah I see. Tried that. Getting undefined variable id in the <option value part: <?php $sql = "SELECT id, name FROM jobs"; $result = $con->query($sql); while(list($name) = mysqli_fetch_row($result)){ ?> <option value="<?php echo $id ?>"><?php echo $name;?></option> <?php } ?> I appreciate your help.
  5. Hi mate That is fine but the issue is, if an end user, such as a non-techy type person, was to create a booking from the backend, selecting an ID will make no sense to them. They will need to see the name of the job they are booking onto.
  6. Hi guys, I am trying to get data from the table "jobs" and insert its id and name into table "bookings" I can get the job "name" from "jobs", which is fine, using the following: <select class="form-control" id="tour_name" name="tour_name"> <option value="Select">== Select Tour or Charter ==</option> <?php $sql = "SELECT name FROM jobs"; $result = $con->query($sql); while(list($name) = mysqli_fetch_row($result)){ ?> <option value="<?php echo $name ?>"><?php echo $name;?></option> <?php } ?> </select> However, when I click submit to insert into "bookings" everything goes in except "booking_id" which is "id" in "jobs". Hope this makes sense. I am using the following to insert: if(isset($_POST['new']) && $_POST['new']==1){ $sql = "SELECT id FROM jobs"; $result = $con->query($sql); while(list($id) = mysqli_fetch_row($result)){ } $tour_id = isset($_GET['id']) ? $_GET['id'] : ''; $tour_name = mysqli_real_escape_string($con, $_POST['tour_name']); $customer_name = mysqli_real_escape_string($con, $_POST['customer_name']); $customer_address = mysqli_real_escape_string($con, $_POST['customer_address']); $customer_email = mysqli_real_escape_string($con, $_POST['customer_email']); $customer_phone = mysqli_real_escape_string($con, $_POST['customer_phone']); $total_pax = mysqli_real_escape_string($con, $_POST['total_pax']); $status = mysqli_real_escape_string($con, $_POST['status']); $order_at = mysqli_real_escape_string($con, date("Y-m-d H:i:s")); $total_amount = mysqli_real_escape_string($con, $_POST['total_amount']); $query="insert into bookings (`tour_id`, `tour_name`, `customer_name`, `customer_address`, `customer_email`, `customer_phone`, `total_pax`, `status`, `order_at`, `total_amount`)values ('$tour_id', '$tour_name', '$customer_name', '$customer_address', '$customer_email', '$customer_phone', '$total_pax', '$status', '$order_at', '$total_amount')"; mysqli_query($con,$query) or die(mysqli_error($con)); if(mysqli_affected_rows($con)== 1 ){ $message = '<p class="text-success"><i class="fa fa-check"></i> - Record Inserted Successfully</p>'; } } Can anyone please lend a hand with this? 2 Days at it now and ready to hit the Guinness. Cheers, Dan
  7. Hey kicken, Thanks for the reply. I did that and now get this: PHP Parse error: syntax error, unexpected 'if' (T_IF), expecting function (T_FUNCTION) or const (T_CONST) Thanks for your help.
  8. Hi guys, I am trying to calculate hours a person works by calculating the values of text fields in a form. However, when I load the page I get "Class 'times_counter' not found. Here is the calculation code" if(isset($_POST['calculate']) != ""){ class times_counter { private $hou = 0; private $min = 0; private $sec = 0; private $totaltime = '00:00:00'; public function __construct($times){ if(is_array($times)){ $length = sizeof($times); for($x=0; $x <= $length; $x++){ $split = explode(":", @$times[$x]); $this->hou += @$split[0]; $this->min += @$split[1]; $this->sec += @$split[2]; } $seconds = $this->sec % 60; $minutes = $this->sec / 60; $minutes = (integer)$minutes; $minutes += $this->min; $hours = $minutes / 60; $minutes = $minutes % 60; $hours = (integer)$hours; $hours += $this->hou % 24; $this->totaltime = $hours.":".$minutes; } } public function get_total_time(){ return $this->totaltime; } } $times = array( $mondiff->format('%H:%I'), $tudiff->format('%H:%I'), $weddiff->format('%H:%I'), $thdiff->format('%H:%I'), $fridiff->format('%H:%I'), $satdiff->format('%H:%I'), $sundiff->format('%H:%I'), ); $counter = new times_counter($times); I had this on an old project, which I no longer have but it worked then. Any ideas?
  9. Got is working <?php require_once "config.php"; $json = array(); $sqlQuery = "SELECT id, name AS title, dep_date AS start, ret_date AS end FROM jobs ORDER BY id"; $result = mysqli_query($con, $sqlQuery); $eventArray = array(); while ($row = mysqli_fetch_assoc($result)) { array_push($eventArray, $row); } mysqli_free_result($result); mysqli_close($con); echo json_encode($eventArray); ?> Thank you both so much for your help. Love your work.
  10. Hi mate, Did a Var dump (I think) and this is what it showed: object(mysqli_result)#2 (5) { ["current_field"]=> int(0) ["field_count"]=> int(1) ["lengths"]=> array(1) { [0]=> int(1) } ["num_rows"]=> int(1) ["type"]=> int(0) }
  11. Hi mate, Nothing in console. Just a few things with datatables, which I am aware of. Is there an alternative calendar script that I can use that you would recommend? Thanks for your help.
  12. I have changed that now. All I want to do is display the name, start date and finish date in the calendar. $data = array(); $query = "SELECT * FROM tours ORDER BY id"; $statement = $con->prepare($query); $statement->execute(); $result = $statement->fetchAll(); foreach ($result as $row) { $data[] = array( 'id' => $row["id"], 'title' => $row["name"], 'start' => $row["dep_date"], 'end' => $row['ret_date'] ); } echo json_encode($data); I have never used calendars before and am clueless with Javascript etc so any help with this would be appreciated.
  13. Hi guys, I am trying to display tour information in fullcalendar but nothing is happening and no errors. Here is the php code from fetch-tours.php <?php require_once "config.php"; $json = array(); $sqlQuery = "SELECT * FROM jobs ORDER BY id"; $result = mysqli_query($con, $sqlQuery); $eventArray = array(); while ($row = mysqli_fetch_assoc($result)) { $title = isset($row['name']); $start = isset($row['dep_date']); $end = isset($row['ret_date']); $eventsArray['title'] = $title; $eventsArray['start'] = $start; $eventsArray['end'] = $end; array_push($eventArray, $row); } mysqli_free_result($result); mysqli_close($con); echo json_encode($eventArray); ?> And here is the Javascript that displays the calendar: <script type="text/javascript"> $(document).ready(function() { var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); $('#calendar').fullCalendar( { header: { left: 'prev,next today', center: 'title', right: 'month,basicWeek,basicDay' }, editable :true, events: "includes/fetch-tours.php", }); }) </script> The calendar displays fine but just no data. Any help is greatly appreciated. Cheers, Dan
  14. Hello guys, Been a while. Between travelling half the bloody country, being sick and travelling again (work), I finally got time to sit down and look into this issue. Got it to work by using the following array in my php code: $res[] = array("value"=>$row['location_phone'],"label"=>$row['location_name']); My next goal is to make you guys so proud. 😂 Yes, I am going to use my upcoming leave from work to change all my code to prepared. Thanks so much for all your help and advice thus far. I had to reread what you said about using the ajax plugin to set the phone number to a text box upon selection of location name. Thanks so much for this. Dan
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.