我有一个从Mysql动态检索的php表,我还在表中有一个输入字段来编辑一列。
当我点击桌子上的任何地方时,表格会消失 - 所以我使用了指针事件:无;在css。这解决了这个问题,但是现在当我点击输入字段输入内容时,表格会再次消失。
当我点击输入字段输入内容时,我不希望表格消失。
我在输入字段的css中尝试了许多不同的Pointer事件而没有任何运气......如果我接受指针事件:auto;在输入字段的css之外,我无法点击所有
的输入字段以下是我的代码 - 有谁知道我做错了什么?
我的表格代码:
<div id="table1" class="table1">
<form action="" method="post">
<?php
if(isset($_POST["submit"]))
{
$searchTerm=$_POST['search'];
$stmt = $conn->prepare(" SELECT question.description AS question, answer.description AS answer, discipline.name AS name, response.responseid AS responseid, response.response AS response, response.student_id AS student_id, response.Date_Time AS Date
FROM response
INNER JOIN answer ON response.question_id = answer.answerid
INNER JOIN question ON response.question_id = question.qid
INNER JOIN discipline ON response.discipline_id = discipline.disciplineid WHERE Date_Time LIKE :searchTerm");
$stmt->bindValue(':searchTerm','%'.$searchTerm.'%');
$stmt->execute();
$result=0;
/*
The above code is a query which selects attributes according to the search term
*/
echo "<table> <tr><th>Discipline</th><th>Question</th><th>Student ID</th><th>Response</th><th>Date & Time</th><th>Answer</th><th>Final Marks</th></tr>";
while ($response = $stmt->fetch()) /* This is a While loop which iterates each row */
{
echo " <tr><td>".$response["name"]."</td><td>".$response["question"]."</td><td>".$response["student_id"]."</td><td>".$response["response"]."</td><td>".$response["Date"]."</td><td><input type='text' name='date' value=". $response["answer"]."></td></tr> ";
$result++;
}
} /* This bit of code closes the connection with the database */
?>
<input type="submit" name="save" value="save">
</form>
</div>
CSS:
.table1 {
position: fixed;
pointer-events: none;
background-color: white;
border-collapse: collapse;
width: 40px;
color: black;
margin-left: 50px;
margin-top: 66px;
white-space: nowrap;
}
.table1 input {
pointer-events: auto;
width: 20px;
height:25px;
}