我失去了"我从表单提交按钮。表格完美无缺,我不知道自己做了什么,但刚才我看到它已经消失了。我在css中造型,也许是弄得一团糟。我也无法在devTools中找到它。可能这将是一个面对面的问题,对此感到抱歉。 这是代码(我只把提交后写的css的一部分放在那里),但我不确定我只用css搞砸了:
.table_ocjene {
text-align: center;
table-layout:fixed;
border-collapse: collapse;
width: 100%;
}
.table_ocjene th {
word-wrap:break-word;
}
.table_ocjene td {
width: auto;}
input[type=text] {
background: #f9ffd1;
width:80%; }

<?php
session_start();
if(!isset($_SESSION['username']) || empty($_SESSION['username'])){
header("location: login.php");
exit;
}
require_once "wp-config.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel = "stylesheet" type = "text/css" href= "../../style/welcome.css" >
<link rel="stylesheet" href="../../style/mobile.css" type="text/css" media="only screen and (max-device-width:480px)" />
</head>
<body>
<h1><b><?php $user = $_SESSION['username'];
echo $user; ?></b>, unesite ocjene .</h1>
<?php //--------------------------- EXECUTE FORM
if($_POST['submit']){
echo " <p > " .$user.", uspješno ste unijeli nove ocjene. </p>";
$idCount = count($_POST['id']);
for($i=0; $i<$idCount; $i++) {
$mjerenja = $_POST['mjerenja'][$i];
$osnove = $_POST['osnove'][$i];
$digitalna = $_POST['digitalna'][$i];
$id =$_POST['id'][$i];
//unos ocjena i bodova spajanje na sql preko forme
$sql_update ="UPDATE ucenici SET mjerenja = '$mjerenja' , osnove = '$osnove' , digitalna = '$digitalna' WHERE id = $id;";
if(mysqli_query($link, $sql_update)){
} else{
echo "ERROR: Could not able to execute $sql_update " . mysqli_error($link);
}
}
}
//----------------------------------unos ocjena i bodova u listu učenika ----------------------------------------
$sqli = "SELECT * FROM ucenici WHERE struka = 'elektrotehnicar'; ";
if($result = mysqli_query($link, $sqli)){
if(mysqli_num_rows($result)>0){
echo "<table class = 'table_ocjene'>";
echo "<tr>";
echo "<th width='35'>Red. br.</th>";
echo "<th>Ime</th>";
echo "<th>Osnove elektrotehnike</th>";
echo "<th>Mjerenja u elektrotehnici </th>";
echo "<th>Digitalna elektronika </th>";
echo "</tr>";
//Loop for ucenici
while($row = mysqli_fetch_array($result)){
$username = $row['username'];
?>
<tr>
<td><?php print $row['id'];?> </td>
<td><?php print $row['username']?></td>
<form method = 'post' enctype="multipart/form-data" action = '<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>' >
<td><input type = 'text', name = 'osnove[]' value = '<? echo $row['osnove'] ?>' id = 'osnove' class= "textarea"></td>
<td><input type = 'text', name = 'mjerenja[]' value = '<? echo $row['mjerenja'] ?>' id = 'mjerenja'class= "textarea"></td>
<td><input type = 'text', name = 'digitalna[]' value = '<? echo $row['digitalna'] ?>' id = 'digitalna'class= "textarea"></td></tr>
<input type = 'hidden', name = 'id[]' id = 'id' value = "<?php print $row['id'] ?>"
<?php
}
echo "<input type = 'submit' name = 'submit' value = 'Upload'>";
echo "</form>";
echo "</table></div>";
}
else{
echo "No records matching your query were found.";
}
}
else {
echo "ERROR: Could not able to execute $sqli. " . mysqli_error($link);
}
mysqli_close($link);
?>
<a href="../../index.php" class="sign_out_ocjene" >Sign Out </a>
</body>
</html>
&#13;
答案 0 :(得分:1)
//关闭隐藏的输入
<input type = 'hidden', name = 'id[]' id = 'id' value = "<?php print $row['id'] ?>" />
答案 1 :(得分:-1)
您的提交按钮没有消失,它就在您的HTML中。
echo "<input type = 'submit' name = 'submit' value = 'Upload'>";
您的表单是否有效是另一回事。