'Printing buttons acording to values on the database

I have 2 buttons, one is to accept, the other one is to refuse and I have a field on the database called "status".
If the value of that field is "Refused" it prints both buttons but the refuse button is disabled, in order to not let the user refuse again, only letting the user accept and if the value is "Accepted" it prints both buttons but the accept one is disabled.
I wanted to know if my code could be improved and if there was a most efficient way to do this than the way that I did it (which I think it's a poor solution and that's why I'm posting this question).
The code:

<?php
      if ($status == "Accepted") {
         echo "<button disabled style='width:130px;cursor:not-allowed;' class='btn btn-success' name='accept' type='submit'><b>Accept</b></button>";
         echo "<button style='width:130px; margin-left: 10px;' class='btn btn-danger' name='refuse' type='submit'><b>Refuse</b></button>";
      } else if ($status == "Refused") {
         echo "<button disabled style='width:130px;cursor:not-allowed; margin-left: 10px;' class='btn btn-danger' name='refuse' type='submit'><b>Refuse</b></button>";
         echo "<button style='width:130px; margin-left: 10px' class='btn btn-success' name='accept' type='submit'><b>Accept</b></button>";
      }
?>
php


Solution 1:[1]

This is really a coding-style question. There are no "correct" answers. Just opinions.

However, if you were to rewrite this code in a shorter way, you would probably make it less readable to other developers. Since the point of your question is to improve the code, and I assume you mean "make this more readable", then I think you're best off leaving it alone.

The only problem I would highlight is that you've changed the order in which the buttons are displayed. If you display two buttons on a page, then the next time you view that page, the same two buttons should be in the same order on that page. Otherwise people may click the wrong one by mistake.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kae Verens