<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Update a Record</TITLE>
</HEAD>
<BODY>

<?
/***************************************************************************
 *			do_updaterec3.php	                           *
 *                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~	                   *
 *   File Info:		  Update category                                  *
 *   Copyright:       Copyright 2003 http://www.128concepts.com            *
 *						                           *
 ***************************************************************************/
include("./config.php");
include("./header.inc");
?>
<?
$table = "category";
  if ($_SERVER['REQUEST_METHOD'] == "POST") 
  {
        # escape data and set variables
        $catid = addslashes($_POST["catid"]);

}

$conn = @mysql_connect($server,$user,$password)
	or die("Unable to connect to SQL database...");
$rs = @mysql_select_db($database,$conn) 
	or die("Unable to select the database...Please press 'Create Database' to create new database.");
echo("<br><img src=images/line.gif border=0 width=100% height=1><font face=verdana size=2>Updating category record with CATEGORY ID = ");
echo($catid);
echo("</font><br>");
$done = "FALSE";
$sql = " SELECT category,catid,cpic from $table where catid = '$catid'";
$rs = @mysql_query($sql,$conn)
	or die("Could not execute SQL query!!! Possibly SQL query already been executed.");
while($row=mysql_fetch_array($rs))
{
       echo("<font face=verdana size=2>Category: </font>".$row["category"]); 
       echo("<br><font face=verdana size=2>Category ID: </font>".$row["catid"]);
       echo("<br><font face=verdana size=2>Category Picture: </font>".$row["cpic"]);
       echo("<br><font face=verdana size=2>Press the 'View Records' menu link to view all category records.</font><img src=images/line.gif border=0 width=100% height=1>");
       $done = "OK";
       $category=$row["category"];
       $catid = $row["catid"];
       $cpic = $row["cpic"];
}
if ($done=="FALSE")
{
	echo("<font face=verdana size=2>Opps...its seems cannot update category record with CATEGRY ID = ");
	echo($catid);
	echo "</font><img src=images/line.gif border=0 width=100% height=1><br><br><br><br><br>";
	include_once("./your-footer.inc");
	exit();
}
$form = "<form action=do_updates3.php";
$form.=" method=\"POST\">";
$form.="Category ID:<br> ";
$form.="<input type = hiden name = catid value = $catid readonly><br>";
$form.="Category:<br>";
$form.="<input type = \"text\" name=\"category\"";
$form.=" value=\"$category\" size = \"40\"><br>";
$form.="Category Picture: <br>";
$form.="<input type=\"text\" name=\"cpic\"";
$form.="value=\"$cpic\" size=\"40\" maxlength=\"128\"><br><br>";
$form.="<input type=\"submit\" value=\"Update Record\">";
$form.="</form>";
echo($form);
?>
<br><font face=verdana size=2 color=navy>To update the category record, update the fields and then press 'Update Record' to update the category record '<?php echo "$pid"?>'</font><br><br>
<center>
<table width="500" border=1><tr align="justify" class="subtitle"><td>
  <p align="center">
  <img border="0" src="images/database.GIF" width="24" height="24"><font face=Verdana size=1><a href="./create_db.php">Create database</a>&nbsp;
  <img border="0" src="images/database.GIF" width="24" height="24"></font><a href="./delete_db.php"><font face=Verdana size=1>Delete database</font></a><font face="Verdana" size="1">&nbsp;
  <img border="0" src="images/Records.GIF" width="24" height="24"><a href="./create_menu.php">Create table</a>&nbsp;&nbsp;&nbsp;&nbsp;
  <img border="0" src="images/Records.GIF" width="24" height="24">&nbsp;
  </font> <a href="./add_menu.php"><font face=Verdana size=1>Add Record </font></a>  
  </p>
  <p align="center">&nbsp;<font face="Verdana" size="1"><img border="0" src="images/Records.GIF" width="24" height="24"></font><a href="./view_menu.php"><font face=verdana size=1>View Records</font></a>&nbsp;
  <font face="Verdana" size="1">&nbsp;&nbsp;&nbsp;
  <img border="0" src="images/Records.GIF" width="24" height="24"></font><a href="./del_menu.php"><font face=verdana size=1>Delete Record</font></a>
  <font face="Verdana" size="1">&nbsp;&nbsp;&nbsp;
  <img border="0" src="images/Records.GIF" width="24" height="24"></font> <a href="./upd_menu.php"><font face=verdana size=1>Update Record</font></a>&nbsp;
  <img border="0" src="images/home-to.GIF" width="24" height="24"><font face=verdana size=1>&nbsp; <a href="./index.php">Home</a></font>  </a></td></tr></table><br></center>
<?php include("./your-footer.inc");?>
</BODY>
</HTML>
