2015-11-08 63 views
1

以下代碼每行添加一個接受/拒絕按鈕。但由於某種原因,拒絕按鈕不會出現。我不知道什麼是錯的。現在卡住了一段時間。幫助將不勝感激。謝謝!!按鈕不出現在表格

<?php 
        $con=mysqli_connect("localhost","root","","rabco"); 
        // Check connection 
        if (mysqli_connect_errno()) 
        { 
        echo "Failed to connect to MySQL: " . mysqli_connect_error(); 
        } 

        $result = mysqli_query($con,"SELECT * FROM service_request"); 


        echo "<table border='1'> 
        <tr> 
        <th>Service ID</th> 
        <th>Service Type</th> 
        <th>Schuduled Date</th> 
        <th>Scheduled Time</th> 
        <th>Client Reference 
        <th>Client ID</th> 
        <th>Admin ID</th> 
        <th>Special Instructions</th> 
        <th>Status</th> 
        <th>Approve</th> 
        <th>Decline</th> 
        </tr>"; 

        while($row = mysqli_fetch_array($result)) 
        { 
        echo "<tr>"; 
        echo "<td>" . $row['Service_ID'] . "</td>"; 
        echo "<td>" . $row['Service_type'] . "</td>"; 
        echo "<td>" . $row['Sched_date'] . "</td>"; 
        echo "<td>" . $row['Sched_time'] . "</td>"; 
        echo "<td>" . $row['Client_reference'] . "</td>"; 
        echo "<td>" . $row['Client_IDN'] . "</td>"; 
        echo "<td>" . $row['Admin_IDN'] . "</td>"; 
        echo "<td>" . $row['Special_instructions'] . "</td>"; 
        echo "<td>" . $row['Request_status'] . "</td>"; 
        echo "<td><a href='approve.php?Service_ID=".$row['Service_ID'].">Approve</a></td>"; 
        echo "<td><a href='decline.php?Service_ID=".$row['Service_ID'].">Decline</a></td>"; 
        echo "</tr>"; 
        } 
        echo "</table>"; 

        mysqli_close($con); 
       ?> 

回答

0

你缺少你的href屬性,這是創造畸形的HTML輸出收盤報價。

你需要改變:

echo "<td><a href='approve.php?Service_ID=".$row['Service_ID'].">Approve</a></td>"; 
echo "<td><a href='decline.php?Service_ID=".$row['Service_ID'].">Decline</a></td>"; 

echo "<td><a href='approve.php?Service_ID=".$row['Service_ID']."'>Approve</a></td>"; 
echo "<td><a href='decline.php?Service_ID=".$row['Service_ID']."'>Decline</a></td>"; 
+0

謝謝!!!錯過了結束報價!謝謝 :))) –

0

有缺少一個右引號的位置:

echo "<td><a href='approve.php?Service_ID=".$row['Service_ID'].">Approve</a></td>"; 

更改爲:

echo "<td><a href='approve.php?Service_ID=".$row['Service_ID']."'>Approve</a></td>"; 
+0

謝謝!!!!!!!錯過了這句話! :)) –

+0

我很驚訝你不接受我的回答6個月後的日期。有問題嗎? – trincot