Hello I'm trying to make a telephone contacts list using PHP and MySQLi.
This part of the program should display a list of all contacts with a delete button next to each row. Pressing the delete button should pass the $firstname value to another page and then do some further MySqli processing.
For some reason, the $firstname variable does not get passed on to the next page.
$results = $db->query("SELECT first_name, last_name, tele FROM contacts");
// Column headings
print '<table border="1">';
print '<tr>';
print '<td>First name</td>';
print '<td>Last name</td>';
print '<td>Telephone number</td>';
while($row = $results->fetch_object()) {
$firstname = $row->first_name;
print '<tr>';
print '<td>'.$firstname.'</td>';
print '<td>'.$row->last_name.'</td>';
print '<td>'.$row->tele.'</td>';
print '<td>
<form action="delete.php" action="POST">
<input type="hidden" name="firstname" value="'.$firstname.'">
<input type="submit" value="Delete">
</form>
</td>
</tr>';
}
print '</table>';
csawmentioned in his answer,methodshould be post, not theactiontwice. And @NiettheDarkAbsol has right also.