Nelson Cruz Postado Junho 11, 2012 Denunciar Share Postado Junho 11, 2012 Pessoal sou novato na area e estou com um trabalho para entregar e não estou conseguindo resolver.Fiz um questionario para ser aplicado na minha empresa, porem não sei como recuperar as respostas para gravar no banco. Será que alguém pode me ajudar?<% response.Expires = 0 %> <% response.ExpiresAbsolute = Now() - 1 %> <% response.addHeader "pragma","no-cache" %> <!--#include file="func_login.asp"--> <!--#include file="novoINFO/_Estilos.asp"--> <% mrLogon = Request.ServerVariables("LOGON_USER") If mrLogon = "" then Response.Redirect "http://info.rj.caixa" End if 'Busco informações do usuário RetLogin = Ret_Info_Login() mrLogin = retlogin(0) mrDominio = retlogin(2) 'Critico o domínio if (mrDominio <> "RIODEJANEIRO") and (mrDominio <> "COREDF") and (mrLogin <> "C045320") and (mrLogin <> "C073156") and (mrLogin <> "C037635") and (mrLogin <> "C048902") then Response.Redirect "erro.asp?mensagem=Sistema não disponível para o seu domínio!" Response.end end if Set conexao = Server.CreateObject("ADODB.Connection") Set rsResposta = Server.CreateObject("ADODB.Recordset") Set rsPergunta = Server.CreateObject("ADODB.Recordset") conexao.CommandTimeout = 600 conexao.ConnectionTimeout = 600 server.ScriptTimeout=600 cntServidor = "SERVER=RXXXX;uid=saGITEL;pwd=XXXX;driver={SQL Server};database=INFO;" conexao.Open cntServidor %> <HTML> <HEAD> <TITLE>PESQUISA</TITLE> <script language="javascript"> function validar(){ alert("Entrei"); } </script> </HEAD> <BODY> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td class="Arial10_CZE_B">Caro Operador,<br><br> Visando a permanente melhoria de nossas atividades, pedimos que você responda ao questionário abaixo, considerando os feedbacks recebidos do(a) monitor (a) _______________ . Não é necessário se id entificar e, desde já, agradecemos sua participação. </td> </tr> </table> <FORM method="post" name="SubmitSel" action="pesQualidade.asp?Exibir=Sim" onSubmit="java script:return validar()" > <table border="0" cellpadding="0" cellspacing="0"> <% SQL = "SELECT cod_pergunta, " &_ " des_pergunta, " &_ " tip_pergunta " &_ " FROM tb_pergunta " &_ " WHERE cod_prova = 1 " &_ " ORDER BY cod_pergunta" rsPergunta.Open SQL, conexao,0,1 Do while not rsPergunta.EOF %> <br> <br> <tr> <td class="Arial10_CZE_B"><%=rsPergunta("des_pergunta")%></td> <tr><br> <% SQL = "SELECT CAST(tb_questionario.cod_pergunta AS varchar(4)) + '_' + CAST(tb_questionario.cod_resposta AS varchar(4)) AS id," &_ " tb_questionario.cod_resposta, " &_ " tb_resposta.des_resposta, " &_ " tb_resposta.opt_permite_desc " &_ " FROM tb_questionario INNER JOIN " &_ " tb_resposta ON tb_questionario.cod_resposta " &_ " = tb_resposta.cod_resposta " &_ " WHERE tb_questionario.cod_pergunta = " & rsPergunta("cod_pergunta") rsResposta.Open SQL, conexao,0,1 %> <table border="0" cellpadding="0" cellspacing="0"> <% Do while not rsResposta.EOF if rsPergunta("tip_pergunta") = "D" then %> <tr> <td><input id=<% =rsPergunta("cod_pergunta") %> name="<% =rsPergunta("cod_pergunta") %>" type="text" maxlength="350" size="150" ></td> </tr> <% elseif rsPergunta("tip_pergunta") = "E" then %> <tr> <td><input id=<% =rsPergunta("cod_pergunta") %> name="<% =rsPergunta("cod_pergunta") %>" value="<% =rsResposta("cod_resposta") %>" type="radio"> </td> <td class="Arial10_CZE"><%=rsResposta("des_resposta")%></td> </tr> <% elseif rsPergunta("tip_pergunta") = "M" then %> <tr> <td><input id=<% =rsPergunta("cod_pergunta") %> name="<% =rsPergunta("cod_pergunta") %>" value="<% =rsResposta("cod_resposta") %>" type="checkbox"> </td> <td class="Arial10_CZE"><%=rsResposta("des_resposta")%> <% if rsResposta("opt_permite_desc") = "S" then %> <input id=<% =rsPergunta("cod_pergunta") %> name="<% =rsPergunta("cod_pergunta") %>" type="text" maxlength="350" size="40"> <% end if %> </td> </tr> <% end if rsResposta.MoveNext Loop %> </table> <% rsResposta.close rsPergunta.MoveNext Loop rsPergunta.close %> </table> <TABLE width="100%"> <TR> <td align="center"> <INPUT align="left" type="submit" class="botao" value="Enviar"> </td> </TR> </TABLE> </form> <% set registro = nothing conexao.close set resposta = nothing set conexao = nothing %> </BODY> </HTML> Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 bareta Postado Junho 13, 2012 Denunciar Share Postado Junho 13, 2012 use request.form("campo") para recuperar os campos passados por POST e request.querystring("campo") para GET Citar Link para o comentário Compartilhar em outros sites More sharing options...
Pergunta
Nelson Cruz
Pessoal sou novato na area e estou com um trabalho para entregar e não estou conseguindo resolver.
Fiz um questionario para ser aplicado na minha empresa, porem não sei como recuperar as respostas para gravar no banco.
Será que alguém pode me ajudar?
<% response.Expires = 0 %> <% response.ExpiresAbsolute = Now() - 1 %> <% response.addHeader "pragma","no-cache" %> <!--#include file="func_login.asp"--> <!--#include file="novoINFO/_Estilos.asp"--> <% mrLogon = Request.ServerVariables("LOGON_USER") If mrLogon = "" then Response.Redirect "http://info.rj.caixa" End if 'Busco informações do usuário RetLogin = Ret_Info_Login() mrLogin = retlogin(0) mrDominio = retlogin(2) 'Critico o domínio if (mrDominio <> "RIODEJANEIRO") and (mrDominio <> "COREDF") and (mrLogin <> "C045320") and (mrLogin <> "C073156") and (mrLogin <> "C037635") and (mrLogin <> "C048902") then Response.Redirect "erro.asp?mensagem=Sistema não disponível para o seu domínio!" Response.end end if Set conexao = Server.CreateObject("ADODB.Connection") Set rsResposta = Server.CreateObject("ADODB.Recordset") Set rsPergunta = Server.CreateObject("ADODB.Recordset") conexao.CommandTimeout = 600 conexao.ConnectionTimeout = 600 server.ScriptTimeout=600 cntServidor = "SERVER=RXXXX;uid=saGITEL;pwd=XXXX;driver={SQL Server};database=INFO;" conexao.Open cntServidor %> <HTML> <HEAD> <TITLE>PESQUISA</TITLE> <script language="javascript"> function validar(){ alert("Entrei"); } </script> </HEAD> <BODY> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td class="Arial10_CZE_B">Caro Operador,<br><br> Visando a permanente melhoria de nossas atividades, pedimos que você responda ao questionário abaixo, considerando os feedbacks recebidos do(a) monitor (a) _______________ . Não é necessário se id entificar e, desde já, agradecemos sua participação. </td> </tr> </table> <FORM method="post" name="SubmitSel" action="pesQualidade.asp?Exibir=Sim" onSubmit="java script:return validar()" > <table border="0" cellpadding="0" cellspacing="0"> <% SQL = "SELECT cod_pergunta, " &_ " des_pergunta, " &_ " tip_pergunta " &_ " FROM tb_pergunta " &_ " WHERE cod_prova = 1 " &_ " ORDER BY cod_pergunta" rsPergunta.Open SQL, conexao,0,1 Do while not rsPergunta.EOF %> <br> <br> <tr> <td class="Arial10_CZE_B"><%=rsPergunta("des_pergunta")%></td> <tr><br> <% SQL = "SELECT CAST(tb_questionario.cod_pergunta AS varchar(4)) + '_' + CAST(tb_questionario.cod_resposta AS varchar(4)) AS id," &_ " tb_questionario.cod_resposta, " &_ " tb_resposta.des_resposta, " &_ " tb_resposta.opt_permite_desc " &_ " FROM tb_questionario INNER JOIN " &_ " tb_resposta ON tb_questionario.cod_resposta " &_ " = tb_resposta.cod_resposta " &_ " WHERE tb_questionario.cod_pergunta = " & rsPergunta("cod_pergunta") rsResposta.Open SQL, conexao,0,1 %> <table border="0" cellpadding="0" cellspacing="0"> <% Do while not rsResposta.EOF if rsPergunta("tip_pergunta") = "D" then %> <tr> <td><input id=<% =rsPergunta("cod_pergunta") %> name="<% =rsPergunta("cod_pergunta") %>" type="text" maxlength="350" size="150" ></td> </tr> <% elseif rsPergunta("tip_pergunta") = "E" then %> <tr> <td><input id=<% =rsPergunta("cod_pergunta") %> name="<% =rsPergunta("cod_pergunta") %>" value="<% =rsResposta("cod_resposta") %>" type="radio"> </td> <td class="Arial10_CZE"><%=rsResposta("des_resposta")%></td> </tr> <% elseif rsPergunta("tip_pergunta") = "M" then %> <tr> <td><input id=<% =rsPergunta("cod_pergunta") %> name="<% =rsPergunta("cod_pergunta") %>" value="<% =rsResposta("cod_resposta") %>" type="checkbox"> </td> <td class="Arial10_CZE"><%=rsResposta("des_resposta")%> <% if rsResposta("opt_permite_desc") = "S" then %> <input id=<% =rsPergunta("cod_pergunta") %> name="<% =rsPergunta("cod_pergunta") %>" type="text" maxlength="350" size="40"> <% end if %> </td> </tr> <% end if rsResposta.MoveNext Loop %> </table> <% rsResposta.close rsPergunta.MoveNext Loop rsPergunta.close %> </table> <TABLE width="100%"> <TR> <td align="center"> <INPUT align="left" type="submit" class="botao" value="Enviar"> </td> </TR> </TABLE> </form> <% set registro = nothing conexao.close set resposta = nothing set conexao = nothing %> </BODY> </HTML>Link para o comentário
Compartilhar em outros sites
1 resposta a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.