<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Add a Record</TITLE>
<script language="JavaScript">
function newWindow(mypage,myname,w,h,features) {
  if(screen.width){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}
</script>
</HEAD>
<BODY  bgcolor = "#f9f9f9">


<TABLE cellSpacing=0 cellPadding=0 border=0 width="100%" style="border-collapse: collapse" bordercolor="#FFFFFF" height="1" bgcolor="#FFFFFF">
        <TR><form method="post" action="login.php"> 
             <TD bgcolor="#FFFFFF" width="185" height="15" rowspan="3">
	<p align="center">
          <img border="0" src="images/EZ-LOGO.GIF" align="left" width="223" height="71"><p>&nbsp;<p align="center">
          &nbsp;</TD>
            <TD bgcolor="#FFFFFF" width="144" height="91" rowspan="3">
          &nbsp;</TD>
            <TD bgcolor="#FFFFFF" width="64" height="34" bordercolor="#FFFFFF">
	 <p align="center">
          <img border="0" src="images/USERNAME.GIF" width="62" height="25"></TD>
            <TD bgcolor="#FFFFFF" width="133" height="34" bordercolor="#FFFFFF">
          <p align="center">
          <input class=FORMTEXT name="username" size="19" style="border-style: solid; border-width: 1"></TD>
          </TR>
        <tr>
            <TD bgcolor="#FFFFFF" width="64" height="35" bordercolor="#FFFFFF">
          <p align="center">
          <img border="0" src="images/PASSWORD.GIF" width="58" height="27"></TD>
            <TD bgcolor="#FFFFFF" width="133" height="35" bordercolor="#FFFFFF">
          <p align="center">
          <input class=FORMTEXT name="passwrd" size="19" style="border-style: solid; border-width: 1" type="password"></TD>
          </tr>
              
        <tr>
            <TD bgcolor="#FFFFFF" width="197" height="22" colspan="2" bordercolor="#FFFFFF">
	    <input type = image src="images/logon1.gif" hspace="6" width="27" height="18" align="left"></form><a href="logout.php">
            <img border="0" src="images/logoff1.gif" hspace="1" width="55" height="18" align="right"></a><a href=newpass.php><FONT face=Verdana color=#3a6b93 size=2>Register User</font></TD>
            </a>
          </tr>
        <TR>
          <TD bgcolor="#FFFFFF" width="537" height="12" colspan="4">
          <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="101%" id="AutoNumber1" height="1">
            <tr>
              <td width="102%" height="1">
              <p align="center">
              </td>
            </tr>
            <tr>
              <td width="100%" height="1">
              </td>
            </tr>
          </table>
          </TD>
          </TR></TABLE>

<BR><center><img src=images/computer.gif border=0><font face=verdana size=4 color=navy> Adding a Record to STOCKS</font></center><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>
<img src=images/line.gif border=0 width=100% height=1><br><br>



<?php
include("./config.php");
$table = "category";
$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.");
$sql = " SELECT * from $table order by category";
$rs = mysql_query($sql,$conn)
	or die("Could not execute SQL query!!! Possibly SQL query already been executed.");
$number = mysql_num_rows($rs);

$form = "<FORM action=do_addrecord2.php method=POST>";
$form.="<table cellspacing=5 cellpadding=5>";
$form.="<tr><td valign=top><strong><font face=verdana size=2>Stock ID:</font></strong></td><td valign=top><INPUT type=\"text\" name=\"pid\" size=5 maxlength=5></td></tr>";
$form.="<tr><td valign=top><strong><font face=verdana size=2>Stock Item:</font></strong></td><td valign=top><INPUT type=\"text\" name=\"sitem\" size=50></td></tr>";

$form.="<tr><td valign=top><strong><font face=verdana size=2>Category:</font></strong></td><td valign=top><select name=\"scat\">";

if ($number ==0)
{
	$form.="<option value = \"No Category\"><font face=verdana size=2>-- No Category --</font></option>";
}
else
{
	while ($row = mysql_fetch_array($rs))
	{
		$category = $row["category"];
		$form.="<option value = \"$category\"><font face=verdana size=2>-- $category --</font></option>";
	}
}
$form.="</select></td></tr>";
$form.="<tr><td valign=top><strong><font face=verdana size=2>Picture:</font></strong></td><td valign=top><INPUT type=\"text\" name=\"spic\" size=80><a href = javascript:newWindow('./upload.html','acePopup',450,300,'scrollbars=yes')><font face=verdana size=2>Upload Picture</font></a></td></tr>";
$form.="<tr><td valign=top><strong><font face=verdana size=2>Stock:</font></strong></td><td valign=top><INPUT type=\"text\" name=\"stock\" size=5></td></tr>";
$form.="<tr><td valign=top><strong><font face=verdana size=2>Color:</font></strong></td><td valign=top><INPUT type=\"text\" name=\"color\" size=15></td></tr>";
$form.="<tr><tr><td valign=top><strong><font face=verdana size=2>Size:</font></strong></td><td valign=top><INPUT type=\"text\" name=\"size\" size=10></td></tr>";$form.="<tr><td align=center colspan=2><INPUT type=\"submit\" value=\"Add Record\"><INPUT type=\"reset\" value=\"Clear\"></td></tr>";
$form.="</table></FORM>";

echo($form);
?><img src=images/line.gif border=0 width=100% height=1>
<br><p align=justify><img src=images/readme.gif border=0><font face = "Verdana" color = 0000CC size=2> NOTE TO USERS: The Stock Item input should be identical to Product Item for a particular product. Also if you input the location for pictures, the location is ./images/xxxx.jpg where xxxx = name of picture. If you uploading pictures for the enlarged image - please make sure you use the format xxxx-big.jpg or xxxx-big.gif or xxxx-big.png where xxxx is filename.</font></p>
</BODY>
</HTML>

