From ali, 6 Years ago, written in Plain Text.
This paste is a reply to Re: do-not-refresh from ali - view diff
Embed
  1. <?php
  2. include("includes/db.php");
  3.  
  4. if(isset($_REQUEST["gref"]))
  5. {
  6. // echo "<pre>";
  7. // print_r($_REQUEST);
  8. // die;
  9. $date=date('d-m-Y');
  10. $time=date('H:i:s');
  11. $gref=$_REQUEST["gref"];
  12. $gip=$_REQUEST["gip"];
  13. $gport=$_REQUEST["gport"];
  14. $staff=$_REQUEST["staff"];
  15. $mgw=$_REQUEST["mgw"];
  16. $mussd=$_REQUEST["mussd"];
  17. $prob=$_REQUEST["problem"];
  18. $action=$_REQUEST["action"];
  19. $comment=$_REQUEST["comment"];
  20. //echo 1;
  21.  
  22. mysql_query("insert into minutes(date,time,g_ref,g_ip,g_port,staff,m_gw,m_ussd,problem,action,comment)values('$date','$time','$gref','$gip','$gport','$staff','$mgw','$mussd','$prob','$action','$comment')");
  23. echo 1;
  24. die;
  25. }
  26. ?>
  27.  
  28. <!DOCTYPE html>
  29. <html>
  30. <head>
  31. <meta charset="utf-8" />
  32. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  33. <title>Page Title</title>
  34. <meta name="viewport" content="width=device-width, initial-scale=1">
  35. <link rel="stylesheet" type="text/css" media="screen" href="main.css" />
  36. <script src="main.js"></script>
  37. </head>
  38. <body>
  39. <form method="post" id="frm1">
  40. Gateway Ref:
  41. <select name="gref">
  42. <option>Select Any One</option>
  43. <option value="Ish-01-Qmr">Ish-01-Qmr</option>
  44. </select><br><br>
  45. Gateway IP:<Input type="radio"name="gip"value="192.168.101.101" required>192.168.101.101<Input type="radio"name="gip"value="192.168.101.102" required>192.168.101.102
  46. </select><br><br>
  47. Gateway Port:
  48. <select name="gport" required>
  49. <option value="">Select Any One</option>
  50. <option value="Port00">Port00</option>
  51. <option value="Port01">Port01</option>
  52. <option value="Port02">Port02</option>
  53. <option value="Port03">Port03</option>
  54. <option value="Port04">Port04</option>
  55. <option value="Port05">Port05</option>
  56. <option value="Port06">Port06</option>
  57. <option value="Port07">Port07</option>
  58. <option value="Port08">Port08</option>
  59. <option value="Port09">Port09</option>
  60. <option value="Port10">Port10</option>
  61. <option value="Port11">Port11</option>
  62. <option value="Port12">Port12</option>
  63. <option value="Port13">Port13</option>
  64. <option value="Port14">Port14</option>
  65. <option value="Port15">Port15</option>
  66. </select><br><br>
  67. Staff:<Input type="text" name="staff"><br><br>
  68. Minutes On Gateway:<Input type="text" name="mgw"><br><br>
  69. Minutes On USSD:<Input type="text" name="mussd"><br><br>
  70. Problem:
  71. <select name="problem">
  72. <option>Select Any One</option>
  73. <option value="Package minutes consumed.">Package minutes consumed.</option>
  74. <option value="Not showing USSD response.">Not showing USSD response.</option>
  75. <option value="Sim Blocked.">Sim Blocked.</option>
  76. <option value="Port Status showing Power Off.">Port Status showing Power Off.</option>
  77. <option value="Port Status showing No SIM Card.">Port Status showing No SIM Card.</option>
  78. </select><br><br>
  79. Action:
  80. <select name="action">
  81. <option>Select Any One</option>
  82. <option value="Minutes in overview are set as USSD.">Minutes in overview are set as USSD.</option>
  83. </select><br><br>
  84. Comments:<Input type="text" name="comment" required><br><br>
  85. <br><br>
  86. <Input type="submit" value="insert" name="submit">
  87. </form>
  88. </body>
  89. <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> <!-- load jquery via CDN -->
  90. <script>
  91. $(document).ready(function(){
  92. $('form').submit(function(event) {
  93. event.preventDefault();
  94.  
  95. // get the form data
  96. // there are many ways to get this data using jQuery (you can use the class or id also)
  97. var formData = $(this).serializeArray()
  98.  
  99. // process the form
  100. $.ajax({
  101. type : 'POST', // define the type of HTTP verb we want to use (POST for our form)
  102. // url : '', // the url where we want to POST
  103. data : formData, // our data object
  104. dataType : 'json', // what type of data do we expect back from the server
  105. encode : true
  106. })
  107. // using the done promise callback
  108. .done(function(data) {
  109. // reset the form data
  110.  
  111. document.getElementById('frm1').reset();
  112.  
  113. // log data to the console so we can see
  114. alert('done');
  115.  
  116. // here we will handle errors and validation messages
  117. });
  118.  
  119. // stop the form from submitting the normal way and refreshing the page
  120. });
  121.  
  122.  
  123. })
  124. </script>
  125. </html>