View and Edit Suppliers


Under the "Suppliers" main menu "View / Edit Suppliers" sub menu is linked to view_edit_suppliers.php file. Here you can view and edit suppliers details. However deleting a supplier is not provided here or anywhere else. You can develop this function to delete a supplier. It is not recommended to delete the entire record from the MySQL database. The best thing to do is add a new column called "Status" and change the status to delete. This need to alter all the other pages that shows suppliers, to show only not deleted suppliers.

<?php include("inc/page_header.php"); ?>
<?php
 if(check('Add/Edit Customers') != 'Valid'){
  header("Location: sys_home.php?pre=error");
  ob_end_flush();
 }
?>

 <div class="wrapper">

  <div class="s100">
  <div class="boxtitle">Suppliers</div>
   <table width="99%" cellpadding="3px" cellspacing="1px">
    <tr id="headrow">
     <td>ID</td>
     <td>Name</td>
     <td>Address</td>
     <td>Telephone</td>
     <td>Fax</td>
     <td>Actions</td>
    </tr>
    <?php
     $q = mysql_query("SELECT * FROM suppliers");
     while($r = mysql_fetch_assoc($q)){
      echo "<tr>";
      echo "<td id=\"sh4\">{$r['Supplier_ID']}</td>";
      echo "<td id=\"sh3\">{$r['Supplier_Title']} {$r['Supplier_Name']}</td>";
      echo "<td id=\"sh4\">{$r['Supplier_Address']}, {$r['Supplier_Address_2']}, {$r['Supplier_City']}</td>";
      echo "<td id=\"sh3\">{$r['Supplier_Telephone']}</td>";
      echo "<td id=\"sh4\">{$r['Supplier_Fax']}</td>";
      echo "<td id=\"sh3\"><a href=\"edit_supplier.php?id={$r['Supplier_ID']}\">Edit</a></td>";
      echo "</tr>";
     }
    ?>
   </table>
  </div>
  
 </div>
 
<?php include("inc/page_footer.php"); ?>

Comments