Hi
I need help to make my table headers selectable so that when i click on any of the column headers it will be sorted as in a - z of high to low or vise versa
here is my code so far
Code:<?php include_once 'index.php'; ?> <!DOCTYPE html> <html> <head> <title>Phonebook</title> <link href="style.css" rel="stylesheet" type="text/css" /> <style type="text/css"> body { background-image: url("background-wallpapers-19.jpg"); } </style> <script type="text/javascript"> function ConfirmDelete(){ var d = confirm('Do you really want to delete data?'); if(d == false){ return false; } } </script> </head> <body> <div class="wrapper"> <div class="content" > <?php include 'header.php'; ?><br/> <div style="margin-bottom: 5px;"> <form method="POST" action="index.php"> <input type="text" id="searchText" name="searchText" style="width:300px"/> <input type="hidden" name="action_type" value="search"/> <input type="submit" value="Search"> </form> </div> <div style="max-height: 350px; overflow:auto;"> <table id="content" class="pbtable"> <thead> <tr> <th> Name </td> <th> Contact # </th> <th> Res. Address </th> <th> Company </th> <th> Company Address </th> <th></th><th></th> </tr> </thead> <tbody> <?php foreach($contact_list as $contact) : ?> <tr> <td> <?php echo $contact["contact_name"]; ?> </td> <td> <?php echo $contact["contact_no"]; ?> </td> <td> <?php echo $contact["residential_address"]; ?> </td> <td> <?php echo $contact["company"]; ?> </td> <td> <?php echo $contact["company_address"]; ?> </td> <td> <form method="post" action="index.php"> <input type="hidden" name="ci" value="<?php echo $contact["contact_id"]; ?>" /> <input type="hidden" name="action" value="edit" /> <input type="submit" value="Edit" /> </form> </td> <td> <form method="POST" action="index.php" onSubmit="return ConfirmDelete();"> <input type="hidden" name="ci" value="<?php echo $contact["contact_id"]; ?>" /> <input type="hidden" name="action" value="delete" /> <input type="submit" value="Delete" /> </form> </td> <tr> <?php endforeach; ?> </tbody> </table> </div> <br/> <a href="update.php" class="link-btn">Add Contact</a> </div> </div> </body> </html>
thanks in advance


Reply With Quote

Bookmarks