2017-03-09 44 views
-1

我擁有適用於我們軟件工程的管理信息系統。這是我想要發生的事情。輸入客戶的基本信息後,他/她的記錄(帶ID)將顯示在客戶列表中。旁邊是2個按鈕,第一個按鈕是'Contract 1',第二個是'Contract 2'。在填寫其中一份合同後,我希望按鈕不可點擊。防止用戶在某些表格填滿後重新打開(單擊)按鈕

(另一種解釋) 如果合同是空的,使'按鈕'可點擊以便用戶可以添加。但是填充後,該按鈕將無法再使用。

我想你可能需要此代碼

<?php 
        include 'connect-db.php'; 
       ?> 

       <table class="myTable" width="80%"> 


        <th width="5%">Customer<br>Number</th> 
        <th>CRC</th> 
        <th>Name</th> 
        <th>Service<br>Contract</th> 
        <th>Chapel<br>Contract</th> 
       </tr> 
       <?php 
        $sql = "SELECT * FROM records ORDER BY CustomerNumber DESC LIMIT 5"; 
        $result = mysql_query($sql); 
        if(mysql_num_rows($result) > 0){ 
         while($row = mysql_fetch_assoc($result)){ 

       ?> 
          <tr> 
           <td><?=$row['CustomerNumber']?></td> 
           <td><?=$row['CRC']?></td> 
           <td><?=$row['Name']?></td> 
           <td> 
            **<a href="editprocess-service.php?CustomerNumber=<?=$row['CustomerNumber']?>">Add</a> 
           </td> 
           <td> 
            <a href="editprocess-chapel.php?CustomerNumber=<?=$row['CustomerNumber']?>">Add</a> 
           </td>** 

          </tr> 
       <?php 
         } 
        } 
       ?> 
    </table> 
    <br>   
    <a href="masterlist.php"><input type="button" value="New Record" style="margin-left: 785px;"></a> 

以粗體顯示的代碼就是我想要的神奇的事情發生。先謝謝你!

回答

0

如果您將合同信息存儲在表格字段中,那麼您可以使用PHP函數檢查是否設置了值。

if(isset($row['contract'])) { 
    //echo disabled button 
} else { 
    //eco interactable button 
} 
0

是簡單地禁用的onclick

<button id="myBtn"onclick="myFunction()">My Button</button> 
相關問題