include("includes/db.php");
if(isset($_REQUEST["submit"]))
{
$lot=$_REQUEST["lot"];
$date=$_REQUEST["date"];
$operator=$_REQUEST["operator"];
$iname=$_REQUEST["iname"];
$ivno=$_REQUEST["ivno"];
$vvalue=$_REQUEST["vvalue"];
$vno=$_REQUEST["vno"];
$gref=$_REQUEST["gref"];
$gip=$_REQUEST["gip"];
$gport=$_REQUEST["gport"];
$comment=$_REQUEST["comment"];
if(mysql_query("insert into vouchers(lot,date,operator,i_name,i_v_no,v_value,v_no,g_ref,g_ip,g_port,comment)values('$lot','$date','$operator','$iname','$ivno','$vvalue','$vno','$gref','$gip','$gport','$comment')"))
{
header("Location:vouchers.php");
exit;
}
else
{
echo
// 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"];
$prob=$_REQUEST["problem"];
$action=$_REQUEST["action"];
$comment=$_REQUEST["comment"];
echo 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')");
die;
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</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"
Lot # :<Input type="text" name="lot" required><br><br>
Date :<Input type="date" name="date" required><br><br>
Operator :<Input type="radio"name="operator"value="Zong" required>Zong<Input type="radio"name="operator"value="Telenor" required>Telenor<Input type="radio"name="operator"value="Jazz" required>Jazz
</select><br><br>
Item Name :
<?php $filename = 'includes/iname.txt';
$eachlines = file($filename, FILE_IGNORE_NEW_LINES);//create an array
echo '<select name="iname" id="value" required>';
echo "<option value=''>Select Anyone</option>";
foreach($eachlines as $lines){
echo "<option value='{$lines}'>{$lines}</option>";
}
echo '</select>'; ?><br><br>
I Voucher# :<Input type="text" name="ivno" required><br><br>
Voucher Value :<Input type="radio"name="vvalue"value="100" required>100<Input type="radio"name="vvalue"value="300" required>300<Input type="radio"name="vvalue"value="500" required>500<Input type="radio"name="vvalue"value="1000" required>1000 <br><br>
Voucher # :<Input type="text" name="vno" required><br><br>
Gateway
<select name="gref">
<option>Select Any One</option>
<option value="Ish-01-Qmr">Ish-01-Qmr</option>
</select><br><br>
<?php $filename = 'includes/gref.txt';
$eachlines = file($filename, FILE_IGNORE_NEW_LINES);//create an array
echo '<select name="gref" id="value" required>';
echo "<option value=''>Select Anyone</option>";
foreach($eachlines as $lines){
echo "<option value='{$lines}'>{$lines}</option>";
}
echo '</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
Gateway Port:
$eachlines = file($filename, FILE_IGNORE_NEW_LINES);//create an array
echo '<select name="gport"
<option value="">Select Any One</option>
<option value="Port00">Port00</option>
<option value="Port01">Port01</option>
<option value="Port02">Port02</option>
<option value="Port03">Port03</option>
<option value="Port04">Port04</option>
<option value="Port05">Port05</option>
<option value="Port06">Port06</option>
<option value="Port07">Port07</option>
<option value="Port08">Port08</option>
<option value="Port09">Port09</option>
<option value="Port10">Port10</option>
<option value="Port11">Port11</option>
<option value="Port12">Port12</option>
<option value="Port13">Port13</option>
<option value="Port14">Port14</option>
<option value="Port15">Port15</option>
</select><br><br>
Staff:<Input type="text" name="staff"><br><br>
Minutes On Gateway:<Input type="text" name="mgw"><br><br>
Minutes On USSD:<Input type="text" name="mussd"><br><br>
Problem:
<select name="problem">
<option>Select Any One</option>
<option value="Package minutes consumed.">Package minutes consumed.</option>
<option value="Not showing USSD response.">Not showing USSD response.</option>
<option value="Sim Blocked.">Sim Blocked.</option>
<option value="Port Status showing Power Off.">Port Status showing Power Off.</option>
<option value="Port Status showing No SIM Card.">Port Status showing No SIM Card.</option>
</select><br><br>
Action:
<select name="action">
<option>Select Any One</option>
<option value="Minutes in overview are set
echo "<option value=''>Select Anyone</option>";
foreach($eachlines as
</select><br><br>
echo "<option value='{$lines}'>{$lines}</option>";
}
echo '</select>'; ?><br><br>
Comments:<Input type="text" name="comment" required><br><br>
</form>
</body>
<script
<script>
$(document).ready(function(){
$('form').submit(function(event) {
event.preventDefault();
// get the form data
// there
function mess()
{
alert ("Your records are
var formData = $(this).serializeArray()
// 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 : 'json', // what type of data do we expect back from the server
encode : true
})
// using the done promise callback
.done(function(data) {
document.getElementById('frm1').reset();
// 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
});
})
return true;
}
</script>