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

<?
/***************************************************************************
 *			do_updaterec2.php	                           *
 *                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~	                   *
 *   File Info:		  Update Stocks                                    *
 *   Copyright:       Copyright 2003 http://www.128concepts.com            *
 *						                           *
 ***************************************************************************/
include("./config.php");
include("./header.inc");
?>
<?
$table = "stocks";
  if ($_SERVER['REQUEST_METHOD'] == "POST") 
  {
        # escape data and set variables
        $pid = addslashes($_POST["pid"]);
        $sitem = addslashes($_POST["sitem"]);
        $scat = addslashes($_POST["scat"]);
        $spic = addslashes($_POST["spic"]);
        $stock = addslashes($_POST["stock"]);
        $color = addslashes($_POST["color"]);
        $size = addslashes($_POST["size"]);
}


$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 stocks record with Stock ID = ");
echo($pid);
echo("</font><br>");
$done = "FALSE";
$sql = " SELECT pid,sitem,scat,spic,stock,color,size from $table where pid = $pid";
$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>Stock ID: </font>".$row["pid"]); 
       echo(" <br><font face=verdana size=2>Stock Item: </font>".$row["sitem"]);
       echo(" <br><font face=verdana size=2>Category: </font>".$row["scat"]);
       echo(" <br><font face=verdana size=2>Picture: </font>".$row["spic"]);
       echo(" <br><font face=verdana size=2>Stock:  </font>".$row["stock"]);
       echo(" <br><font face=verdana size=2>Color: </font>".$row["color"]);
       echo(" <br><font face=verdana size=2>Size: </font>".$row["size"]."<br>");
       echo("<font face=verdana size=2>Press the 'View Records' menu link to view all stocks records.</font><img src=images/line.gif border=0 width=100% height=1>");
       $done = "OK";
       $sitem=$row["sitem"];
       $scat=$row["scat"];
       $spic=$row["spic"];
       $stock=$row["stock"];
      $color=$row["color"];
     $size=$row["size"];
}

if ($done=="FALSE")
{
	echo("<font face=verdana size=2>Opps...its seems cannot update stocks record with STOCK ID = ");
	echo($pid);
	echo "</font><img src=images/line.gif border=0 width=100% height=1><br><br><br><br><br>";
	include_once("./your-footer.inc");
	exit();
}
echo "<form action=do_updates2.php method=\"POST\">
<input type=\"hidden\" name=\"pid\" value=\"$pid\" size=\"10\">Stock Item:<br>
<input type = \"text\" name=\"sitem\" value=\"$sitem\" size = \"50\"><br>Categories<br>
<select name=\"scat\">
<option value=\"Accessories\" ";if ($scat == "Accessories"){ echo "selected";} echo">Accessories</option>
<option value=\"Bathroom Products\" ";if ($scat == "Bathroom Products"){ echo "selected";} echo ">Bathroom Products</option>
<option value=\"Battery/Charger Products\" "; if ($scat == "Batter/Charger Products"){ echo "selected";} echo ">Battery/Charger Products</option>
<option value=\"Bedroom Products\" ";if ($scat == "Bedroom Products"){ echo "selected";} echo ">Bedroom Products</option>
<option value=\"Bikes/Accessories\" ";if ($scat == "Bikes/Accessories"){ echo "selected";} echo ">Bikes/Accessories</option>
<option value=\"Books & Magazines\" ";if ($scat == "Books & Magazines"){ echo "selected";} echo ">Books & Magazines</option>
<option value=\"Cameras/Photography\" ";if ($scat == "Cameras/Photography"){ echo "selected";} echo ">Cameras/Photography</option>
<option value=\"Car/Accessories\" ";if ($scat == "Car/Accessories"){ echo "selected";} echo ">Car Accessories</option>
<option value=\"CD/Accessories\" ";;if ($scat == "CD/Accessories"){ echo "selected";} echo ">CD/Accessories</option>
<option value=\"Computers/Accessories\" ";;if ($scat == "Computers/Accessories"){ echo "selected";} echo ">Computers/Accessories</option>
<option value=\"Clothing & Fashion\" ";;if ($scat == "Clothing & Fashion"){ echo "selected";} echo ">Clothing & Fashion</option>
<option value=\"Cooking & Food\" ";if ($scat == "Cooking & Food"){ echo"selected";} echo ">Cooking & Food</option>
<option value=\"DVDs/Accessories\" ";if ($scat == "DVDs/Accessories"){ echo "selected";} echo ">DVDs/Accessories</option>
<option value=\"Electrical Products\" ";if ($scat == "Electrical Products"){ echo "selected";} echo ">Electrical Products</option>
<option value=\"Furniture & Fittings\" ";if ($scat == "Furntiture & Fittings"){echo "selected";} echo ">Furniture & Fittings</option>
<option value=\"Garden Products\" ";if ($scat == "Garden Products"){ echo "selected";} echo ">Garden Products</option>
<option value=\"Home / Household\" ";if ($scat == "Home / Household"){ echo "selected";} echo ">Home / Household</option>
<option value=\"Jewellery\" ";if ($scat == "Jewellery"){ echo "selected";} echo ">Jewellery</option>
<option value=\"Kitchen\" ";if ($scat == "Kitchen"){ echo "selected";} echo ">Kitchen</option>
<option value=\"Lighting\" ";if ($scat == "Lighting"){ echo "selected";} echo ">Lighting</option>
<option value=\"Office / Stationary\" ";if ($scat == "Office / Stationary"){ echo "selected";} echo ">Office / Stationary</option>
<option value=\"Personal Hygiene\" ";if ($scat == "Personal Hygiene"){ echo "selected";} echo ">Personal Hygiene</option>
<option value=\"Security Products\" ";if ($scat == "Security Products"){ echo "selected";} echo ">Security Products</option>
<option value=\"Telephone/Mobiles Products\" ";;if ($scat == "Telephone/Mobiles"){ echo "selected";} echo ">Telephone/Mobiles Products</option>
<option value=\"Television/Hi Fi Products\" ";if ($scat == "Television/Hi Fi Products"){ echo "selected";} echo ">Television/Hi Fi Products</option>
<option value=\"Tools/DIY\" ";;if ($scat == "Tools/DIY"){ echo "selected";} echo ">Tools/DIY</option>
<option value=\"Travel\" ";;if ($scat == "Travel"){ echo "selected";} echo ">Travel</option>
<option value=\"Video Products\" ";if ($scat == "Video Products"){ echo "selected";} echo ">Video Products</option>
<option value=\"Watches Products\" ";if ($scat == "Watches Products"){ echo "selected";} echo ">Watches Products</option>
</select><br><br>Picture:<br>
<input type=\"text\" name=\"spic\"
value=\"$spic\" size=\"100\"<br><br>Stock:<br>
<input type=\"text\" name=\"stock\" value=\"$stock\" size=\"10\"><br>
Color:<br><input type=\"text\" name=\"color\"
value=\"$color\" size=\"15\"><br>
Size:<br><input type=\"text\" name=\"size\"
value=\"$size\" size=\"10\"><br><br>
<input type=\"submit\" value=\"Update Record\">
</form>";

?>
<br><font face=verdana size=2 color=navy>To update the stock record, update the fields and then press 'Update Record' to update the stock 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>
