Help,
I have a script that reads data from a database and shows it through a table.
At the end of each line there is a checkbox. if you select it and press submit/edit the ID of the specific line should be given to delete.php.
somehow it doesn't work, I don't know how to get the ID of the row??
<html>
<head>
<title>Task Manager</title>
</head>
<form method="POST" action="delete.php">
<body>
<CENTER>
<?php
include 'error.php';
include 'db.php';
function displayTasks($result)
{
echo "<h1>Overview Tasks</h1>\n";
echo "\n<table border=1>\n<tr>\n" .
"\n\t<th>task1_id</th>" .
"\n\t<th>employee name</th>" .
"\n\t<th>company</th>" .
"\n\t<th>priority</th>" .
"\n\t<th>task</th>" .
"\n<tr>";
while ($row = @mysql_fetch_row($result))
{
echo "\n<tr>";
$test = $row['task1_id'];// this doesn't work here somehow
foreach($row as $data)
echo "\n\t<td> $data </td>";
echo "\n\t<td><input type='radio' name='thesse' value='$test'></td>";
echo "\n</tr>";
}
echo "\n</table>\n";
}
$query = "SELECT * FROM task1";
if (!($connection = @mysql_connect($hostname,
$username,
$password)))
die("Cannot connect");
if (!(mysql_select_db($db, $connection)))
showerror();
if (!($result = @mysql_query ($query, $connection)))
showerror();
displayTasks($result);
if (!(mysql_close($connection)))
showerror();
?>
<input type='Submit' value='edit'>
</CENTER>
</form>
</body>
</html>
I'm happy about every input..
Cheers
A.