I'm doing a computing project for school coursework. It involves PHP, MySQL, and HTML - essentially building a web based app.
I have a PHP table called "users" in a database called "cp11641_users" The content of this table has been echoed into a html table using mysql_query of the following:
<div id='accordion'> <ul>
<li>
<a href='#one'><h4>Edit User Table</h4></a>
<div id='one' class='accordion'>";
$query = "SELECT * FROM users"; //You don't need a ; like you do in SQL
$result = mysql_query($query);
echo "<table class='container'>"; // start a table tag in the HTML
echo " <thead> <tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Username</th>
<th>Edit</th> </tr> </thead> ";
echo "<tbody>";
while($row = mysql_fetch_array($result)){ //Creates a loop to loop through results
echo "<tr><td>" . $row['first'] . "</td><td>" . $row['last'] . "</td><td>" . $row['username'] . "</td><td>" . "edit" . "</td></tr>"; }
echo "</tbody> </table>"; //Close the table in HTML
echo "</div>
</li>";
This obviously puts the contents of the PHP table into a HTML table to view. But I want to be able to click the "edit" tab next to each row in the html table, and be able to take the data in that row to be changed/modified/deleted.
This is for the administrator page which should be able to change specific details for each user, that is essentially what I want to do.
I'm thinking that I would need to use the fact that the while loop uses an array from which I can pull specific rows of data (i.e. $Row[1]) and then put that in a $_POST[]? I'm not sure