<!--#include virtual = "/common/lib/dbcon.asp" -->
<!--#include virtual = "/common/lib/func.asp" -->

<!--#include file = "config.asp" -->

<%

R_Fields = "poq_idx ,po_pk ,poq_topmemo, poq_question, poq_type, poq_multi, poq_chk, poq_bogi1, poq_bogi2, poq_bogi3, poq_bogi4, poq_bogi5, poq_wdate, poq_mdate"
Call RequestAll (R_Fields, "")


If poq_idx = "" Then  ' 저장


	' 순서 --------------------------------------
	sql = " SELECT isnull(max(poq_code),0) FROM poll_question WHERE po_pk = "&po_pk
	Set Rs = Dbcon.Execute (sql)
	poq_code = rs(0)
	rs.close : Set rs = Nothing
	
	poq_code = poq_code + 1
	' --------------------------------------------------------


	R_Fields_i = "po_pk ,poq_topmemo, poq_code,  poq_question, poq_type, poq_multi, poq_chk, poq_bogi1, poq_bogi2, poq_bogi3, poq_bogi4, poq_bogi5, poq_wdate, poq_mdate"
	poq_wdate	= getDateFm(now,3)
	poq_mdate	= getDateFm(now,3)
	

	Call InsertQuery(R_Fields_i, "poll_question")
	ok_url = "write_ui.asp?po_pk="&po_pk



else ' 수정


	poq_topmemo = inputvalue(request("poq_topmemo_"&poq_idx))
	poq_question = inputvalue(request("poq_question_"&poq_idx))
	poq_type = inputvalue(request("poq_type_"&poq_idx))
	poq_multi = inputvalue(request("poq_multi_"&poq_idx))
	'poq_chk = inputvalue(request("poq_chk_"&poq_idx))
	poq_bogi1 = inputvalue(request("poq_bogi1_"&poq_idx))
	poq_bogi2 = inputvalue(request("poq_bogi2_"&poq_idx))
	poq_bogi3 = inputvalue(request("poq_bogi3_"&poq_idx))
	poq_bogi4 = inputvalue(request("poq_bogi4_"&poq_idx))
	poq_bogi5 = inputvalue(request("poq_bogi5_"&poq_idx))



	R_Fields_u = "poq_topmemo, poq_question, poq_type, poq_multi, poq_bogi1, poq_bogi2, poq_bogi3, poq_bogi4, poq_bogi5, poq_mdate"
	poq_mdate	= getDateFm(now,3)
	Call UpdateQuery (R_Fields_u, "poll_question", "where poq_idx="&poq_idx)


	ok_url = "write_ui.asp?po_pk="&po_pk


End If


Dbcon.close

Call loding("0",ok_url)

%>