I have a project where I need users to be able to save their work, then at a later date select the session/data from their previous work and continue.
I have completed all of the coding (and it works) to save the current session under their userid, and populates a table with their work.
I now want to be able to give the option to retrieve all of the rows in a table and be able to select a row to load. I have previously created a form where i populate a single field into a drop down and select a single column and that works. However, I am struggling with populating a table with results that a user can pick one row.
I have the table returning the results like this:
echo '<html><Tbody><table border="1" class="ResultsTbl" id="maintable"><th width="10"> ID </th><th width="5">Session</th><th width="5">User</th><th width="10">LastMod Time</th><th width="10">Start Time</th><th width="10">EndTime</th><tr>';
while ($i < sqlsrv_num_fields ( $stmt ))
{
$meta = sqlsrv_field_metadata ( $stmt );
$i = $i + 1;
}
echo '</tr>';
while ( ($row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ))
{
//$formattedDate = date("d-m-Y", strtotime($myrow["date"]));
$formattedLMDate = date("Y-m-d h:i:sa",strtotime($row['lastmod']));
$formattedStartDate = date("Y-m-d h:i:sa",strtotime($row['start']));
$formattedEndDate = date("Y-m-d h:i:sa",strtotime($row['end']));
echo '<td>'.$row['id'].'</td>'.'<td>'.$row['session'].'</td>'.'<td>'.$row['userid'].'</td>'.'<td>'.$formattedLMDate.'</td>'.'<td>'.$formattedStartDate.'</td>'.'<td>'.$formattedEndDate.'</td>';
echo '</tr>';
echo '</tr>';
}
sqlsrv_free_stmt($stmt);
echo '</table></Tbody></html>';
The above code returns a formatted list, but i can't figure out how to make:
- The table to have a 'hover' option where the color changes for the row (mouse hover)
- add a radio button to each row for a user to select a row.
I know this is not simple, and appreciate assistance. Any pointers/directions would help
Thanks,
Greg