Skip to content

How to make a button to jump into specified table row

I have code that generate a table from my database. The code is

<?php include('navbar.php'); ?>
<div class="container">
    <h1 class="page-header text-center">ORDER</h1>
    <form method="POST" action="purchase.php">
        <table class="table table-striped table-bordered">
                <th class="text-center"><input type="checkbox" id="checkAll"></th>
                <th>Product Name</th>
                    $sql="select * from product left join category on category.categoryid=product.categoryid order by product.categoryid asc, productname asc";
                            <td class="text-center"><input type="checkbox" value="<?php echo $row['productid']; ?>||<?php echo $iterate; ?>" name="productid[]" style=""></td>
                            <td><?php echo $row['catname']; ?></td>
                            <td><?php echo $row['productname']; ?></td>
                            <td class="text-right">₨ <?php echo number_format($row['price'], 2); ?></td>
                            <td><input type="text" class="form-control" name="quantity_<?php echo $iterate; ?>"></td>
                            <td><input type="text" class="form-control" name="note_<?php echo $iterate; ?>"></td>

        <div class="row">
            <div class="col-md-3">
                <input type="text" name="customer" class="form-control" placeholder="Customer Name" required>
            <div class="col-md-2" style="margin-left:-20px;">
                <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk"></span> Save</button>
<script type="text/javascript">
            $('input:checkbox').not(this).prop('checked', this.checked);

Now that code will give me a big table. Is there any way to make some link or button to make me jump onto a specific row in a table ? Because scrolling through the big table really not efficient



well, i found a simple solution : I just use <a href="#catname">catname</a> to simply jump into the category I needed on the table