<%
'-----------------------------
    function getIdParent(con,id)
	dim rez
	rez=""
	set rs=server.createObject("adodb.recordset")
	rs.open "select parent from cat where id=" & id,con
	while not rs.eof
	    if rs.bof then break
	    rez=rs("parent").value
	    rs.moveNext
	wend
	rs.close
	set rs=nothing
	if rez="" then rez=0
	getIdParent=rez
    end function
'------------------------------
    function setSelect(tip1,tip2)
	if cint(tip1)=cint(tip2) then
	    setSelect="checked"
	    exit function
	end if
	setSelect=""
    end function
'--------------------------------
    set con=server.createObject("adodb.connection")
    con.open Application("Product")
    
%>
<html>
<body>
<%
    
    '---------------------------
    'afiseaza pagina de 
    id=request("id")
    if id="" then id=0
%>
<h1 align=center>Modify Category</h1>
<form action="updateCategory.asp?id=<%=id%>" method=post>
<table align=center>
<%
	set rs=server.createObject("adodb.recordset")
	rs.open "select * from cat where id=" & id,con
	while not rs.eof
		if rs.bof then break
		sname=rs("name")
		rs.moveNext
	wend
	rs.close
	set rs=nothing
%>
<tr>
<td align=center><b>Name</b></td>
</tr>
<tr>
<td>
<input type=text name="txtName" value="<%=sname%>">
</td>
</tr>
<tr>
<td colspan=3>
    <input type=submit value="Save">
</td>
</tr>
</table>
<%
    parent=getIdParent(con,id)
%>
<input type=hidden name=id value="<%=id%>">
<input type=hidden name=parent value="<%=parent%>">
</form>
<br>
<hr>
<a href="admin.asp?id=<%=parent%>">Back</a>
</body>
</html>
<%
    con.close
    set con=nothing
%>

