到期日期过后如何禁用复选框

时间:2018-06-28 23:37:39

标签: javascript php mysql

我在php中有此代码,它检索了我在数据库中拥有的所有值,并且我希望用户无法选择或篡改已过期的日期,

请你能帮我吗?

以下我的代码仅在网络上向您显示单词“ Expired”和“ Not Expired”,因为我只是在回声。 我只想禁用该复选框,而不希望用户能够更改像雕像之类的东西或删除工作。

请你能帮我吗?

$result = mysqli_query($dbCIE,$sqlCommand) or die(mysql_error()); 

 echo "<form  action='JobsLists.php' method='post'>";


while($row = mysqli_fetch_array($result))
    {


$exp_date = $row['DueDate'];
$today_date = date('Y/m/d');

$exp=strtotime($exp_date);
$td=strtotime($today_date );

if($td>$exp){
  echo"Expiered";
}else{
  echo"NOT Expiered";
}


    echo "<tr>";
    echo "<td> <input type='checkbox' id='myCheck'  name='JobId[]'  value='". $row['JobId'] ."'  /> </td>";
    echo "<td align=center>" . $row['SSU'] . "</td>";
    echo "<td align=center>" . $row['JobName'] . "</td>";
    echo "<td align=center> " . $row['Description'] . "</td>";


    echo "<td align=center>" . $row['DueDate'] . "</td>";


    echo "<td>"."<select name='JobStatus[".$row['JobId']."]'>";
        if($row['JobStatus'] == "InProgress"){
           echo  "<option value='InProgress' selected>In Progress</option>";  
           echo "<option value='Completed'>Completed</option>";
        } else {
            echo  "<option value='InProgress'>In Progress</option>";  
           echo "<option value='Completed' selected> Completed </option>";


        } 

    echo "</select>" . "</td>"; // need to be worked on.. 
    echo "</tr>";
    }
    "</table>";

?>

1 个答案:

答案 0 :(得分:1)

为什么不不将其打印出来?

if (!$td->exp)
    echo "<td> <input type='checkbox' id='myCheck'  name='JobId[]'  value='". $row['JobId'] ."'  /> </td>";

最好不显示按钮或输入,而不是有时将其禁用。可以使用DISABLED关键字禁用输入

<input type="checkbox" name="foo" DISABLED>