How to create submit button on each row ? If i press the button on that row, the information on that row will be confirmed.
What is the problem?
;<input name="<?php echo $row['id']; ?>" type="submit" id="<?php echo $row['id']; ?>" value="Confrim">&
The whole code
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="test_mysql1"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
?>
<form id="form" name="form" method="post" action="confirm.php"><table border='1' cellspacing='0' width='612'>
<tr>
<th bgcolor='green'><font color='white'>#</font></th>
<th bgcolor='green'><font color='white'>Id</font></th>
<th bgcolor='green'><font color='white'>Name</font></th>
<th bgcolor='green'><font color='white'>Lastname</font></th>
<th bgcolor='green'><font color='white'>Email</font></th>
</tr>
<?php
$i = 0;
$number = 0;
while($row = mysql_fetch_array($result)){
$number++;
?>
<?php
$i++;
if($i%2)
{
$bg_color = "#EEEEEE";
}
else {
$bg_color = "#E0E0E0";
}
?>
<tr bgcolor='". $bg_color ."'>
<td><center><Strong><font color='red'><?php echo $row['id']; ?></font></Strong></center></td>
<td><center><Strong><?php echo $row['name']; ?></font></Strong></center></td>
<td><center><Strong><?php echo $row['lastname']; ?></Strong></center></td>
<td><center><Strong><?php echo $row['email']; ?></Strong> <input name="<?php echo $row['id']; ?>" type="submit" id="<?php echo $row['id']; ?>" value="Confrim"> </center></td>
</tr>
<?php } ?>
</table>
<div class="select"><strong>Other Pages: </strong>
<select>
<option>1</option>
</select>
</div>
<label>
</label></form>
confirm.php
if(isset($_POST['accept'])) {
mysql_query("UPDATE $tbl_name SET Status = 'Confirmed' WHERE id = $id");
}