Hello i have a form as you can see in the image below...

![enter image description here](https://i.stack.imgur.com/NWO8n.png)

... In which form I load the first data from my database table...

![enter image description here](https://i.stack.imgur.com/O46ti.png)

what i want is that when i click on a number on the top of the list, to load the appropriate data.

My code is the below (html form code is not included) ...

```
<?php
                $username = $_SESSION["username"];

                if(isset($_POST['idWork'])){

                    $id = $_POST['idWork'];
                    $job_title = mysql_real_escape_string($_POST["job_title"]);
                    $company = mysql_real_escape_string($_POST["company"]);
                    $website = mysql_real_escape_string($_POST["website"]);
                    $start_date = mysql_real_escape_string($_POST["start_date"]);
                    $end_date = mysql_real_escape_string($_POST["end_date"]);
                    $start_year = mysql_real_escape_string($_POST["start_year"]);
                    $end_year = mysql_real_escape_string($_POST["end_year"]);
                    $work_history = mysql_real_escape_string($_POST["work_history"]);
                    if($start_year > $end_year)
                    {
                        echo '<script>ErrorMessage()</script>';
                        $id=$id-1;
                        $good = false;
                    }
                    else
                    {
                        $good = true;
                    }
                    if($good == true){

                    $query="UPDATE work
                            SET job_title = '$job_title', company = '$company', website = '$website', start_date='$start_date', end_date='$end_date', start_year='$start_year', end_year='$end_year', work_history='$work_history'
                            WHERE id='$id' AND username='$username'";

                        mysql_query($query)or die(mysql_error());
                        if(mysql_affected_rows()>=0){
                            echo "<p>Record Updated<p>";
                            echo "<script type='text/javascript'>;
                                    window.location='addCV.php';
                                  </script>";
                        }else{
                            echo "<p>Error Updating Record<p>";
                            echo "<script type='text/javascript'>;
                                    window.location='addCV.php';
                                  </script>";
                        }
                    }
                }
                else{
                  //first time, initialize as you wish. Probably need to get the first id for this user, using another query
                  $id = 0;
                }

                if($query = mysql_query("SELECT job_title,company,website,start_date,end_date,start_year,end_year,work_history FROM work WHERE id>'$id' AND username='$username' order by id asc limit 1") or die(mysql_error()))
                {
                    if(mysql_num_rows($query)>=1){
                        while($row = mysql_fetch_array($query)) {
                        $job_title = $row['job_title'];
                        $company = $row['company'];
                        $website = $row['website'];
                        $start_date = $row['start_date'];
                        $end_date = $row['end_date'];
                        $start_year = $row['start_year'];
                        $end_year = $row['end_year'];
                        $work_history = $row['work_history'];
                        }
                    }

                }
            ?>
            <script>
                $(document).ready(function(){
                    $("#updateWork").click(function(){
                        $("#idW").css("display","none");
                        var r = parseInt($("#idW").val(),10)+1;
                        $("#idW").val(r);
                    });
                });
            </script>
            <p><input type="button" value="Work History" id="SlideMeWorkHistoryButton" style="color: #F87F25; background: black; font: bold 22px Tahoma; width: 16em;  height: 2em; border-radius:7px; padding:4px;"/></p>              
            <div id="SlideMeWorkHistoryForm">
                <?php
                $sql = "SELECT id FROM work WHERE username='$username' order by id asc limit 10;";

                $result = mysql_query($sql);
                if ($result != 0) {

                    $num_results = mysql_num_rows($result);
                    for ($i=0;$i<$num_results;$i++) {
                        $row = mysql_fetch_array($result);
                        $id = $row['id'];
                        echo '<a href="' .$id. '">' .$id. '</a>';
                    }

                }

```