- <?php
- include("includes/db.php");
- if(isset($_REQUEST["gref"]))
- {
- // echo "<pre>";
- // print_r($_REQUEST);
- // die;
- $date=date('d-m-Y');
- $time=date('H:i:s');
- $gref=$_REQUEST["gref"];
- $gip=$_REQUEST["gip"];
- $gport=$_REQUEST["gport"];
- $staff=$_REQUEST["staff"];
- $mgw=$_REQUEST["mgw"];
- $mussd=$_REQUEST["mussd"];
- $balance=$_REQUEST["balance"];
- $prob=$_REQUEST["problem"];
- $action=$_REQUEST["action"];
- $comment=$_REQUEST["comment"];
- //echo 1;
- $header = "<tr>";
- $row = "<tr>";
- foreach ($_REQUEST as $key => $value) {
- $header = $header."<td>".$key."</td>";
- $row = $row."<td>".$value."</td>";
- }
- $header = $header."</tr>";
- $row = $row."</tr>";
- mysqli_query($con,"insert into minutes(date,time,g_ref,g_ip,g_port,staff,m_gw,m_ussd,balance,problem,action,comment)values('$date','$time','$gref','$gip','$gport','$staff','$mgw','$mussd','$balance','$prob','$action','$comment')");
- echo "<table border='2'>".$header.$row."</table>";
- die;
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title>Minutes Detail</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" type="text/css" media="screen" href="main.css" />
- <script src="main.js"></script>
- </head>
- <body>
- <form method="post" id="frm1">
- Gateway Ref:
- <select name="gref" required>
- <option value="">Select Any One</option>
- <option value="Ish-01-Qmr">Ish-01-Qmr</option>
- </select><br><br>
- 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<Input type="radio"name="gip"value="192.168.101.103" required>192.168.101.103
- </select><br><br>
- Gateway Port:
- <?php $filename = 'includes/ports16.txt';
- $eachlines = file($filename, FILE_IGNORE_NEW_LINES);//create an array
- echo '<select name="gport" id="value" required>';
- echo "<option value=''>Select Anyone</option>";
- foreach($eachlines as $lines){
- echo "<option value='{$lines}'>{$lines}</option>";
- }
- echo '</select>'; ?><br><br>
- Staff:<Input type="text" name="staff" required><br><br>
- Minutes On Gateway:<Input type="text" name="mgw"><br><br>
- Minutes On USSD:<Input type="text" name="mussd"><br><br>
- Balance On USSD:<Input type="text" name="balance" required><br><br>
- Problem:
- <?php $filename = 'includes/problem.txt';
- $eachlines = file($filename, FILE_IGNORE_NEW_LINES);//create an array
- echo '<select name="problem" id="value" >';
- echo "<option value=''>Select Anyone</option>";
- foreach($eachlines as $lines){
- echo "<option value='{$lines}'>{$lines}</option>";
- }
- echo '</select>'; ?><br><br>
- Action:
- <?php $filename = 'includes/action.txt';
- $eachlines = file($filename, FILE_IGNORE_NEW_LINES);//create an array
- echo '<select name="action" id="value" >';
- echo "<option value=''>Select Anyone</option>";
- foreach($eachlines as $lines){
- echo "<option value='{$lines}'>{$lines}</option>";
- }
- echo '</select>'; ?><br><br>
- Comments:<Input type="text" name="comment" ><br><br>
- <br><br>
- <Input type="submit" value="insert" name="submit">
- </form>
- </body>
- <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> <!-- load jquery via CDN -->
- <script>
- $(document).ready(function(){
- $('form').submit(function(event) {
- event.preventDefault();
- // get the form data
- // there are many ways to get this data using jQuery (you can use the class or id also)
- var formData = $(this).serializeArray()
- console.log(formData)
- // process the form
- $.ajax({
- type : 'POST', // define the type of HTTP verb we want to use (POST for our form)
- // url : '', // the url where we want to POST
- data : formData, // our data object
- dataType : 'html', // what type of data do we expect back from the server
- encode : true
- })
- // using the done promise callback
- .done(function(data) {
- // reset the form data
- console.log(data)
- document.getElementById('frm1').reset();
- $('#frm1').hide();
- $('body').append(data);
- setTimeout(() => {
- $('#frm1').show();
- $('table').remove();
- }, 15000);
- // log data to the console so we can see
- // alert('done');
- // here we will handle errors and validation messages
- });
- // stop the form from submitting the normal way and refreshing the page
- });
- })
- </script>
- </html>