<?php

// Title: crud_update.php
// Description: See crud.php

// Author: Burton Rosenberg
// Created: 29 May 2007
// Last Update: 30 May

// Copyright (c) 2007 Burton Rosenberg. All rights reserved.

function crud_update($status) {

   if ( 
$status!="" ) {
      echo 
'<div id="statusbox">'.$status.'</div>' ;
   }

  
$idtoupdate $_POST['item'][0] ;
  
$query 'SELECT * FROM `users` WHERE `id`='$idtoupdate ";" ;
  
$result mysql_query($query) ; 

  if ( !
$result ) {
print 
mysql_error() ;
echo 
"can not find result, QUery=$query" ; exit ;
  }

  
$row mysql_fetch_assoc($result) ;
  
mysql_free_result($result);
?>

<form action="crud.php" method="POST">

<input type="hidden" name="id" value="<?=$idtoupdate?>">

<div class="mybox">
<table id="newrow">
<tr>
<td>
<div class="actions">
<input type="radio" name="activity" value="update" checked="checked">Update
</div>
<div class="actions">
<input type="radio" name="activity" value="cancel">Cancel
</div>
<tr>
<th>User name
<td><input type="text" name="username" value="<?=$row['username']?>">
<tr>
<th>Password
<td><input type="password" name="password" value="<?=$row['password']?>">
<tr>
<th>First name
<td><input type="text" name="firstname" value="<?=$row['firstname']?>">
<tr>
<th>Last name
<td><input type="text" name="lastname" value="<?=$row['lastname']?>">
<tr>
<th>Email
<td><input type="text" name="email" value="<?=$row['email']?>">
</table>
</div>

</table>
</div>


<div class="mybox">
<input type="Submit" value="Submit Action" style="color:red;">
</div>

</form>

<?php
   
return ;
}
?>