Hi guys,

I have php code that generates a table based on the results of a mysql query. My questions is how do I update edit the html table row and push the changes to a mysql table? I am using this example: http://bootsnipp.com/snipps/table-with-users The thing I am trying to avoid is to call another page. I would like to give the user the ability to edit the data on the same page rather than drilling down into another one. Here is a snippit of my table build:

while($row = array($getResults))
{
    $stat;
    if($row['status'] == 0)
    $stat = "<span class='label label-success'>User</span>";
    else if($row['status']  == 1)
    $stat = "<span class='label label-warning'>Club Admin</span>";
    else if($row['status']  == 3)
    $stat = "<span class='label label-important'>Banned</span>";
    else
    $stat = "<span class='label label-info'>System Admin</span>";

    echo "<tr>
    <td>" . $row['username'] . "</td>".
    "<td style='text-align:center'>" . $row['fullName'] . "</td>".
    "<td style='text-align:center'>" . $stat . "</td>".
    "<td style='text-align:left'><a href='#'><i class='icon-pencil'></i></a></td>
    </tr>";
}

On the last column of '<td style='text-align:left'><a href='#'><i class='icon-pencil'></i></a></td>' I would like to generate a modal or just make the row fields editable and then update the changes on the back end. Thanks for your help!

The idea is to use jQuery/javascript to create a form with the row you want to edit and push the changes to a server side script via AJAX when the form is submitted.

ok thanks guys, i'll try to apply your suggestions

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.