Q:

Adding one php button per line in a table

I'm trying to build a very basic table to display the results of a query and allow posting the ID from one row (selected with a button on that row) to another php form for further editing the entry.  A pretty basic todo list.
I've been able to make a nice looking table but am a bit stumped about how to get the TaskID value from the array into the value of the form.  
Immediately above and below the form is ?> and 

Can someone point out the flaw in my logic?  I've tried using an intermediate variable $tmp but this did nothing.  I've googled and searched but am not sure how to implement this.  I'm not great a java and ajax so many of the other solutions I've spotted on the web haven't panned out.
$result = mysql_query("SELECT * FROM Tasks WHERE ISNULL(AssignedTo)") 
or die(mysql_error());  

echo "<table border='1'>";
echo "<tr> <th>ID</th> 
  <th>Name</th> 
  <th>Priority</th> 
  <th>Description</th> 
  <th>Location</th> 
  <th>Location2</th> 
  <th>Update this Entry</th></tr>";

while($row = mysql_fetch_array( $result )) 
{

$tmp=$row['TaskID'];
echo "<tr><td>"; 
echo $row['TaskID'];
echo "<td>"; 
echo $row['TaskName'];
echo "<td>"; 
echo $row['TaskPriority'];
echo "<td>"; 
echo $row['TaskDesc'];
echo "<td>"; 
echo $row['TaskContainer'];
echo "<td>"; 
echo $row['TaskContainerIdentifier'];
echo "<td>"; 
?>

   <form name="form" method="POST" action="form_updatetask.php">
     <input value=$tmp type="hidden" name="search">
     <input type="submit"  value="Update">
   </form>

<?php
}
   echo "</td></tr>";
echo "</table>";
?>

A:

You mixed html and php which is fine but in your html you used a variable.
This obviously must be within <?php ?> tags. Also you need to echo that value like this:
<input value="<?php echo $tmp;?>" type="hidden" name="search">

so your code will look like this:
$result = mysql_query("SELECT * FROM Tasks WHERE ISNULL(AssignedTo)") 
or die(mysql_error());  

echo "<table border='1'>";
echo "<tr> <th>ID</th> 
  <th>Name</th> 
  <th>Priority</th> 
  <th>Description</th> 
  <th>Location</th> 
  <th>Location2</th> 
  <th>Update this Entry</th></tr>";

while($row = mysql_fetch_array( $result )) 
{

$tmp=$row['TaskID'];
echo "<tr><td>"; 
echo $row['TaskID'];
echo "<td>"; 
echo $row['TaskName'];
echo "<td>"; 
echo $row['TaskPriority'];
echo "<td>"; 
echo $row['TaskDesc'];
echo "<td>"; 
echo $row['TaskContainer'];
echo "<td>"; 
echo $row['TaskContainerIdentifier'];
echo "<td>"; 
?>

   <form name="form" method="POST" action="form_updatetask.php">
     <input value="<?php echo $tmp;?>" type="hidden" name="search">
     <input type="submit"  value="Update">
   </form>

<?php
}
   echo "</td></tr>";
echo "</table>";
?>

