<?
session_start();
$us= $HTTP_SESSION_VARS['uid'];
//echo "user=$us<br>";
?>
<HTML>
<LINK REL="stylesheet" TYPE="text/css" HREF="menu.css">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Menu - Produktlist edit</title>
</head>
<body class="body1">
<?
include("menu.ini");
echo "<TABLE border=1 align=center CELLSPACING=0 CELLPADDING=5 class=prod><TR clas=table><TD>Ðазвание</TD><TD>Тип</TD><TD>Цена</TD><TD>Ðагазин</TD><TD>ÐолиÑеÑÑво</TD><td>СекÑоÑ</td><TD>ÐÑпиÑÑ</TD><TD>ÐокÑпаÑÑ Ð²Ñегда</TD><td></td><TR>";
echo "<form name=edit-select method=POST action=rezult.php>";
$strsql = "select p.prod_name,t.typ_name,p.prod_price,p.markt,p.menge, p.sector , p.sel, p.prod_id, p.const, p.user_id from product p, prod_type t where p.user_id='$us' and (t.typ_id=p.prod_type) and t.user_id='$us' ORDER BY prod_type;";
//echo "str=$strsql <br>";
$result = mysql_query($strsql, $connection);
$i=0;
while ( $row = mysql_fetch_row($result) )
{
$i+=1;
echo "<TR><TD>";
echo "<input type=text name=prod_name_$i size=35 value=$row[0] class=field></TD><TD><select name=prod_type_$i class=field><option selected>$row[1]</option>";
echo "<BR>";
$strsql1 = "select typ_name,typ_id from prod_type where user_id='$us' ORDER BY typ_id;";
$result1 = mysql_query($strsql1, $connection);
$j=0;
while ( $row1 = mysql_fetch_row($result1) )
{
$j+=1;
echo "<OPTION>$row1[0]</OPTION><BR>";
}
echo "</SELECT> </TD><TD><input type=text name=prod_price_$i size=7 value=$row[2] class=field></TD><TD><SELECT name=markt_$i class=field>";
$strsqlm = "select markt_name from markt where markt_id='$row[3]';";
$resultm = mysql_query($strsqlm, $connection);
$m=0;
while ( $rowm = mysql_fetch_row($resultm) )
{
$m+=1;
$row[3]=$rowm[0];
}
echo "<OPTION selected> $row[3]</option>";
$strsql2 = "select markt_name,markt_id from markt where user_id='$us';";
$result2 = mysql_query($strsql2, $connection);
$m=0;
while ( $row2 = mysql_fetch_row($result2) )
{
$m+=1;
echo "<OPTION>$row2[0]</OPTION><BR>";
}
echo "</SELECT> </TD><TD><input type=text name=menge_$i size=5 value=$row[4] class=field></TD>";
echo "<TD><input type=text name=sector_$i size=3 class=field value=$row[5]></TD>";
echo "<TD><input type=checkbox name=sel_$i value=Yes class=field ";
if ($row[6]=="Yes") { echo "checked";}
echo"></TD><TD><input type=checkbox name=const_$i value=Yes class=field ";
if ($row[8]=="Yes") { echo "checked";}
echo "</TD>";
echo "<td><a href=prod_del.php?prod_id=$row[7]><button>УдалиÑÑ</button></a> </td><input type=hidden name=prod_id_$i value=$row[7]></TR>";
}
?>
<TR><TD COLSPAN=7 align=center><INPUT type=submit value=РедакÑиÑоваÑÑ name=Edit><TD></TR>
</form>
</TABLE>