1
我有這段代碼,我不能讓提交按鈕正常工作 請幫助我。我準備了3個按鈕,我還沒有處理過這個動作。但按鈕不工作,即使當我只是想回應的東西提交按鈕不工作
<?php
require_once '../dbinfo.inc.php';
session_start();
// CHECK IF THE USER IS LOGGED ON ACCORDING
// TO THE APPLICATION AUTHENTICATION
if(!isset($_SESSION['username'])){
echo <<< EOD
<h1>You are UNAUTHORIZED !</h1>
<p>INVALID usernames/passwords<p>
<p><a href="../login.php">LOGIN PAGE</a><p>
EOD;
exit;
}
// GENERATE THE APPLICATION PAGE
$conn = oci_pconnect(ORA_CON_UN, ORA_CON_PW, ORA_CON_DB);
// 1. SET THE CLIENT IDENTIFIER AFTER EVERY CALL
// 2. USING UNIQUE VALUE FOR BACK END USER
oci_set_client_identifier($conn, $_SESSION['username']);
$username = htmlentities($_SESSION['username'], ENT_QUOTES);
if (isset($_POST["ajax"]) && $_POST["ajax"] == 1){
$sql = "SELECT QTY FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'";
$cutting_sql = "SELECT CUTTING FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'";
$assembly_sql = "SELECT ASSEMBLY FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'";
$welding_sql = "SELECT WELDING FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'";
$drilling_sql = "SELECT DRILLING FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'";
$finishing_sql = "SELECT FINISHING FROM FABRICATION WHERE HEAD_MARK = '{$_POST["hm"]}'";
$stid = oci_parse($conn, $sql);
$stid_cutting = oci_parse($conn, $cutting_sql);
$stid_assembly = oci_parse($conn, $assembly_sql);
$stid_welding = oci_parse($conn, $welding_sql);
$stid_drilling = oci_parse($conn, $drilling_sql);
$stid_finishing = oci_parse($conn, $finishing_sql);
// The defines MUST be done before executing
oci_define_by_name($stid, 'QTY', $qty);
oci_execute($stid);
oci_define_by_name($stid_cutting, 'CUTTING', $cutting);
oci_execute($stid_cutting);
oci_define_by_name($stid_assembly, 'ASSEMBLY', $assembly);
oci_execute($stid_assembly);
oci_define_by_name($stid_welding, 'WELDING', $welding);
oci_execute($stid_welding);
oci_define_by_name($stid_drilling, 'DRILLING', $drilling);
oci_execute($stid_drilling);
oci_define_by_name($stid_finishing, 'FINISHING', $finishing);
oci_execute($stid_finishing);
// Each fetch populates the previously defined variables with the next row's data
oci_fetch($stid);
oci_fetch($stid_cutting);
oci_fetch($stid_assembly);
oci_fetch($stid_welding);
oci_fetch($stid_drilling);
oci_fetch($stid_finishing);
//echo quantity to the screen
echo "<b><font size='10'>".$qty."</font></b></br>";
if ($cutting == $qty){
echo "<p><b><font color='#FF8566' size='5'>CUTTING COMPLETED</font></b></p>";
} else {
$maxcutting = $qty - $cutting;
echo "<input id='cutting' name='cutting' type='number' min = '0' max = '$maxcutting' placeholder='CUTTING PROGRESS TODAY' class='input'/>";
}
if ($assembly == $qty){
echo "<p><b><font color='#FF8566' size='5'>ASSEMBLY COMPLETED</font></b></p>";
} else {
$maxassembly = $qty - $assembly;
echo "<input id='assembly' name='assembly' type='number' min = '0' max = '$maxassembly' placeholder='ASSEMBLY PROGRESS TODAY' class='input'/>";
}
if ($welding == $qty){
echo "<p><b><font color='#FF8566' size='5'>WELDING COMPLETED</font></b></p>";
} else {
$maxwelding = $qty - $welding;
echo "<input id='welding' name='welding' type='number' min = '0' max = '$maxwelding' placeholder='WELDING PROGRESS TODAY' class='input'/>";
}
if ($drilling == $qty){
echo "<p><b><font color='#FF8566' size='5'>DRILLING COMPLETED</font></b></p>";
} else {
$maxdrilling = $qty - $drilling;
echo "<input id='drilling' name='drilling' type='number' min = '0' max = '$maxdrilling' placeholder='DRILLING PROGRESS TODAY' class='input'/>";
}
if ($finishing == $qty){
echo "<p><b><font color='#FF8566' size='5'>FINISHING COMPLETED</font></b></p>";
} else {
$maxfinishing = $qty - $finishing;
echo "<input id='finishing' name='finishing' type='number' min = '0' max = '$maxfinishing' placeholder='FINISHING PROGRESS TODAY' class='input'/>";
}
echo '<section></br></br></br>';
echo ' <input type="submit" value="SUBMIT PROGRESS" class="button red" />';
echo ' <input type="reset" value="RESET FIELDS" class="button" /></br>';
echo ' <input type="submit" value="GO TO PAINTING" name="paint" class="button green" /></section>';
die;}
if (isset($_POST['submit'])){
echo $cutting;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title> Update Fabrication Progress</title>
<link type="text/css" rel="stylesheet" href="../css/goldenform/golden-forms.css"/>
<link type="text/css" rel="stylesheet" href="../css/goldenform/font-awesome.min.css"/>
<script type="text/javascript">
function OnSelectionChange (select) {
var selectedOption = select.options[select.selectedIndex];
//some ajax checkpoint
//alert ("The selected option is " + selectedOption.value);
jQuery.ajax({
url: location.href,
data: {'hm':selectedOption.value, 'ajax':1},
type: "POST",
success: function(data) {
jQuery("#lbl_qty").html(data);//PRINT QTY TO THE SCREEN
}
});
//some ajax checkpoint
//alert('after ajax');
}
</script>
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
</head>
<body class="bg-wooden">
<div class="gforms">
<div class="golden-forms wrapper">
<form>
<div class="form-title">
<h2>FABRICATION UPDATE</h2>
</div><!-- end .form-title section -->
<div class="form-enclose">
<div class="form-section">
<fieldset>
<legend>  Select HEADMARK and the details will be shown <span class="bubble blue">1</span></legend>
<section>
<div class="row">
<div class="col4 first">
<label for="headmark" class="lbl-text tleft">HEADMARK :</label>
</div><!-- end .col4 section -->
<div class="col8 last">
<!-- POPULATED DROPDOWN LIST FROM THE DB -->
<label for="headmark" class="lbl-ui select">
<?php
$sql_hm_comp = 'SELECT HEAD_MARK FROM FABRICATION';
$result = oci_parse($conn, $sql_hm_comp);
oci_execute($result);
echo '<SELECT name="headmark" id="headmark" onchange="OnSelectionChange(this)">'.'<br>';
echo '<OPTION VALUE=" ">'."".'</OPTION>';
while($row = oci_fetch_array($result,OCI_ASSOC)){
$HM = $row ['HEAD_MARK'];
echo "<OPTION VALUE='$HM'>$HM</OPTION>";
}
echo '</SELECT>';
?>
</label>
</div>
</div>
</section><!-- END OF DROPDOWN LIST -->
<section>
<div class="row">
<div class="col4 first">
<label for="lnames" class="lbl-text tleft">Total Quantity:</label>
</div>
<div class="col8 last">
<!-- VALUE PASSED FROM AJAX PROCESSING -->
<label id='lbl_qty' class='lbl-ui'><font size='3'> </font></label>
</div>
</div>
</section>
</div><!-- end .form-section section -->
</div><!-- end .form-enclose section -->
<div class="form-buttons">
</div><!-- end .form-buttons section -->
</form>
</div><!-- end .golden-forms section -->
</div><!-- end .gforms section -->
<div></div><!-- end section -->
<div></div><!-- end section -->
</body>
</html>
它仍然沒有工作壽... :( – user3435659
嘗試'的print_r($ _ POST);',而不是'$回聲切割;' – Stocki