Jump to content

fanboime

Members
  • Posts

    15
  • Joined

  • Last visited

fanboime's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm not using any demos. But is ajax affecting this? because i am using ajax to call this method and send post data to this for the queries.
  2. http://www.fpdf.org/ here
  3. Remote Address:127.0.0.1:80 Request URL:http://localhost/ServiceVehicle/php/report.php Request Method:POST Status Code:200 OK Request Headersview source Accept:application/json, text/javascript, */*; q=0.01 Accept-Encoding:gzip,deflate,sdch Accept-Language:en-US,en;q=0.8 Connection:keep-alive Content-Length:13 Content-Type:application/x-www-form-urlencoded; charset=UTF-8 Cookie:jtable%23-1266721797page-size=10; PHPSESSID=9ti0q877hvea3q7gdq06907ji1 Host:localhost Origin:http://localhost Referer:http://localhost/ServiceVehicle/home.php User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36 X-Requested-With:XMLHttpRequest Form Dataview sourceview URL encoded name: d1: d2: Response Headersview source Cache-Control:private, max-age=0, must-revalidate Connection:Keep-Alive Content-Disposition:inline; filename="" Content-Type:application/pdf Date:Mon, 26 May 2014 11:56:34 GMT Expires:Thu, 19 Nov 1981 08:52:00 GMT Keep-Alive:timeout=5, max=96 Pragma:public Server:Apache/2.4.9 (Win64) PHP/5.5.12 Transfer-Encoding:chunked X-Powered-By:PHP/5.5.12 Above is my header returning application/pdf when my parameters are Output('','I') but when i enter the first parameter Output('my.pdf','I') i get appliation/octet-stream
  4. Where can i see this errors?
  5. <?PHP require("../fpdf/fpdf.php"); include("db.classes.php"); $g = new DB(); $g->connection(); class PDF extends FPDF { .....codes..... } $pdf = new PDF(); .....codes..... $pdf->SetFont('Arial','',14); $pdf->AddPage('L', 'Legal'); $pdf->SetXY(20,20); $pdf->image('../images/DCWD Watermark.png'); $pdf->SetY(35); // call the table creation method $pdf->SetFont('Arial','B',16); $pdf->Cell(0,10,$plateNo); $pdf->SetY(45); $pdf->SetFont('Arial','B',16); $pdf->Cell(0,10,$model); $pdf->SetXY(310, 45); $pdf->SetFont('Arial','B',16); $pdf->Cell(0,10,date("m/d/Y")); $pdf->SetY(55); $pdf->BuildTable($header,$data); $pdf->Output(); ?> Why is FPDF's Output not working? or is something wrong with my browser? I already tried putting paramaters on it but still no go I tried Output('foo.pdf','I') not working but if i itegrate my chrome withIDM it just downloads but when i disable integrationnothing happens.
  6. Here is my add driver button $( "#addDriver" ).button().click(function( event ) { event.preventDefault(); var dn = $("input[name=driver_name]").val(); var ds = $("input[name=driver_status]").val(); var dataString = 'driver_name='+ dn + '&driver_status='+ ds; //Here is where im trying to load it but it's not working $('#driversTable').jtable('load'); if(dn == '' || ds == '' ) { alert("Fill up all Fields with \'*\'"); } else { $.ajax({ type: "POST", url: "processDriver.php", data: dataString, dataType: "json", success: function(data){ if(!data.error && data.success) { alert(data.successMsg); $("input[name=driver_name]").val(''); $("input[name=driver_status]").val(''); } else { alert(data.errorMsg); } } }); } }); And here is my jTable init $("#driversTable").jtable({ title: 'Drivers', actions: { listAction: "getAllDrivers.php", }, fields: { did: { key: true, list: false }, dID: { title: 'Driver ID', width: '7%' }, dName: { title: 'Name', width: '7%' }, dStatus: { title: 'Status', width: '12%' } } }); $('#driversTable').jtable('load'); I want it to be right after adding a new record i want the table to refresh without refreshing the page. I tried the load and reload functions of jtable is not working or am i just putting them on the wrong place of my code?
  7. Here is my java script $.each(data, function() { var myTable1 = '<tr bgcolor=#ffffff>' + '<td align=center>'+this.vehiclelog_plate+'</td>' + '<td align=center>'+this.vehiclelog_name+'</td>' + '<td align=center>'+this.vehiclelog_date+'</td>' + '<td align=center>'+this.vehiclelog_reftype+'</td>' + '<td align=center>'+this.vehiclelog_refid+'</td>' + '<td align=center>'+this.vehiclelog_description+'</td>' + '</tr>'; $('#tableField').append(myTable1); }); And here is my HTML <div id="tabs-6"> <div id="rform"> <form action = "home.php" method="post"> <fieldset> <legend>View Vehicle Service</legend><br><br> <div> <label class="label-left">Vehicle Name:</label> <span role="status" aria-live="polite" class="ui-helper-hidden-accessible"></span> <input id="autocomplete" title="type "a"" class="ui-autocomplete-input" name="vehicle_service_search" autocomplete="off"> </div> <div> <button id="searchVehicleDesc" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"> <span class="ui-button-text">View</span> </button> </div> <div> <table border="1" width="650" id = "tableField"> <tr bgcolor=#c0c0c0> <td width=100 align="center"><font face="helvetica"><b>Vehicle Name</b></font></td> <td width=80 align="center"><font face="helvetica"><b>Service Type</b></font></td> <td width=80 align="center"><font face="helvetica"><b>Others</b></font></td> <td width=100 align="center"><font face="helvetica"><b>Reference No.</b></font></td> <td width=80 align="center"><font face="helvetica"><b>Reference Date</b></font></td> <td width=80 align="center"><font face="helvetica"><b>Reference Type</b></font></td> </tr> </table> </div> </fieldset> </form> </div> </div> And here is my response [{"success":1,"plate":"SIX666","name":"YAMAHA ISUZU","date":"0000-00-00","type":"Add Vehicle","id":"0","desc":""},{"success":1,"plate":"VIE597","name":"Resource id #6","date":"2014-05-09","type":"OIL","id":"332142","desc":"castroil"}] Im getting the right response from ajax but I can't put my value to a table I get an alert that says undefined.
  8. Here is my button $( "#editVehicle" ).button().click(function( event ) { event.preventDefault(); var vp = $("input[name=vehicle_plate]").val(), dataString = 'vehicle_plate='+ vp; $.ajax({ type: "POST", url: "editvehicle.php", data: dataString, dataType: "json", success: function(data){ if(!data.error && data.success) { $("input[name=vehicle_model]").val(data.vehicleName); $("input[name=assigned_driver]").val(data.assignedDriver); } else { alert(data.errorMsg); } } }); }); And here is my PHP <?PHP include("db.classes.php"); $g = new DB(); $g->connection(); if($_POST) { $vehiclePlate = $g->clean($_POST["vehicle_plate"],1); $g->edit($vehiclePlate); } $g->close(); ?> and here is my db.classes public function edit($vehiclePlate) { $sql = "select vehicle_name, driver_id from vehicles where vehicle_plate='$vehiclePlate'"; $result = mysql_query($sql) or die(json_encode(array("error" => 0, "errorMsg" => "MySQL query failed."))); $row = mysql_fetch_array($result); if(mysql_num_rows($row)) { echo json_encode(array( "success" => 1, "vehicleName" => $row['vehicle_name'], "assignedDriver" => $row['driver_id'] )); } else { echo json_encode(array( "error" => 1, "errorMsg" => "No rows returned" )); } } There is an input field in my html where i input the vehicle plate then when the user clicks the button the program searches the database for the vehicle name and driver_id with the plate the user entered and returns the value to another inputfield named "vehicle_name" and "assigned_driver" but nothing is happening when the button is clicked not even the error alert message. Any idea on where am i going wrong here?
  9. Here is my ajax $(".submit").click(function(){ var vp = $("input#vehicle_plate").val(); var vm = $("input#vehicle_model").val(); var vt = $("input#vehicle_type").val(); var da = $("input#date_acquired").val(); var ad = $("input#assigned_driver").val(); var dataString = 'vehicle_plate='+ vp + '&vehicle_model='+ vm + '&vehicle_type='+ vt + '&date_acquired='+ da + '&assigned_driver='+ ad; $.ajax({ type: "POST", url: "process.php", data: dataString, success: function(){ $('.success').fadeIn(200).show(); $('.error').fadeOut(200).hide(); } }); return false; }); And here is my PHP where i pass my 'dataString' <?PHP include("db.classes.php"); $g = new DB(); $g->connection(); if($_POST) { $vehiclePlate = $g->clean($_POST["vehicle_plate"],1); $vehicleModel = $g->clean($_POST["vehicle_model"],1); $vehicleType = $g->clean($_POST["vehicle_type"]); $assignedDriver = $g->clean($_POST["assigned_driver"],1); $ad = date('Y-m-d', strtotime($_POST["datepicker"])); $g->add($vehiclePlate, $vehicleModel, $vehicleType, $assignedDriver, $ad); } $g->close(); ?> And here is my database query public function add($vehiclePlate, $vehicleModel, $vehicleType, $assignedDriver, $ad) { $sql = "insert into vehicles(`vehicle_plates`,`DA`,`type`, `model`, `driver`) values('$vehiclePlate', '$ad', '$vehicleType', '$vehicleModel', '$assignedDriver')"; if(!mysql_query($sql)) { $this->error = mysql_error(); return true; } else { return false; } } the AJax is succesful but when i try and see the table in my databse the inserted row are al 'Undefined' what seems to be causing this?
  10. here is my insert method public function add($values) { $sql = "insert into vehicles(`vehicle_plates`,`DA`,`type`, `model`, `driver`) values('$values')"; if(!mysql_query($sql)) { $this->error = mysql_error(); return true; } else { return false; } } And here is my Button click funtion $( "#button" ).button(); $( "#button" ).click(function( event ) { <?PHP if(isset($_POST["subBtn"])) { $fName = $g->clean($_POST["fullname"],1); $sDate = date('Y-m-d', strtotime($_POST["startdate"])); $roomNum = $g->clean($_POST["roomnumber"]); $driver = $g->clean($_POST["driver"],1); $model = $g->clean($_POST["model"],1); $json = '{"a":$fName, "b":$sDate, "c":$roomNum, "d":$model, "e":$driver}'; $array = json_decode($json, true); $values = implode(",", $array); $g->add($values); } ?> }); Everytime i click my button it Postsback and nothing inserts in my database...
  11. Can you please give a tutorial?
  12. I've tried this and whenever i click my button nothing is happening...
  13. Here's my script $( "#button" ).button(); $( "#button" ).click(function( event ) { <?PHP ... ?> }); And here's the input tag <input id="button" type="submit" value="Add" name = "subBtn" /> Whenever i click the button it triggers postback how can i avoid this?
×
×
  • 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.