Quantcast
Channel: Fórum ASP
Viewing all articles
Browse latest Browse all 1214

Editar enquete / atualizar?

$
0
0

Oi Galeria  estou tentando criar um pagina editar as perguntas da enquete porem não to conseguindo alguem pode dar uma ajuda to usando o sistema de enquete BR Enquete V.1 - do Bruno Linhares.

 

Essa código aqui é da pagina de adicionar:

 

 

admin-add.asp

  <form name="frmNewWeeklyPoll" method="post" action="br_enquete_adicionar.asp" onSubmit="return CheckPollForm();">
    <table  width="975" cellspacing="0" cellpadding="0" align="center" height="160" bgcolor="#ffffff">
      <tr>
        <td height="2">
        <h2>   Adicionar nova enquete</h2>
          <table width="100%" border="0" align="center" height="23">
            <tr align="left">
              <td colspan="2" class="arial_sm2" height="30"><font face="Verdana">   *Campos
                obrigatórios</font></td>
            </tr>
            <tr>
              <td align="right" width="28%" height="14"><font face="Verdana">Questão*:
                </font></td>
              <td height="14" width="72%"> <font face="Verdana">
                <input type="text" size="40" maxlength="150" name="Question">
                </font></td>
            </tr>
            <tr>
              <td align="right" height="2" width="28%" class="arial"><font face="Verdana">Opção
                1*: </font></td>
              <td height="2" width="72%"> <font face="Verdana">
                <input type="text" size="40" maxlength="50" name="choice1">
                </font></td>
            </tr>
            <tr>
              <td align="right" height="2" width="28%" class="arial"><font face="Verdana">Opção
                2*: </font></td>
              <td height="2" width="72%"> <font face="Verdana">
                <input type="text" size="40" maxlength="50" name="choice2">
                </font></td>
            </tr>
            <tr>
              <td align="right" height="2" width="28%" class="arial"><font face="Verdana">Opção
                3 : </font></td>
              <td height="2" width="72%"> <font face="Verdana">
                <input type="text" size="40" maxlength="50" name="choice3">
                </font></td>
            </tr>
           
            <tr>
              <td valign="top" align="right" height="25" width="28%">  </td>
              <td height="25" width="72%"> <p>
                  <input type="reset" name="Reset" value="Limpar">
                  <input type="submit" name="Submit" value="Adicionar">
                </p></td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
  </form>

 

 

 

 

Pagina:  br_enquete_adicionar.asp

<%
'Dimensões variáveis
Dim adoCon
Dim strCon    
Dim strAccessDB     
Dim strSQL
Dim saryInputChoice(7)            
Dim blnAddNewPoll

blnAddNewPoll = True


strInputQuestion = Request.Form("Question")

strInputQuestion = Replace(strInputQuestion, "'", "''")

For intGetChoiceLoopCounter = 1 To 7
    saryInputChoice(intGetChoiceLoopCounter) = Request.Form("choice" & intGetChoiceLoopCounter)
    
    saryInputChoice(intGetChoiceLoopCounter) = Replace(saryInputChoice(intGetChoiceLoopCounter), "'", "''")
Next


If strInputQuestion = "" OR saryInputChoice(1) = "" OR saryInputChoice(2) = "" Then blnAddNewPoll = False
 
 
If blnAddNewPoll = True Then
    
    strAccessDB = "br_enquete_db"

    Set adoCon = Server.CreateObject("ADODB.Connection")
    Set adoRec = Server.CreateObject("ADODB.Recordset")
                    
    strCon="DRIVER={Microsoft Access Driver (*.mdb)};"
                
    strCon = strCon & "DBQ=" & Server.MapPath(strAccessDB)
        
    strSQL = "INSERT INTO br_enquete_dados ( Question, Selection_1, Selection_2, Selection_3, Selection_4, Selection_5, Selection_6, Selection_7 )"
    strSQL = strSQL & " VALUES"
    strSQL = strSQL & "('" & strInputQuestion
    
    For intSQLChoiceLoopCounter = 1 To 7        
            strSQL = strSQL & "', '" & saryInputChoice(intSQLChoiceLoopCounter)        
    Next
    
    strSQL = strSQL & "');"
    
    adoCon.Open strCon
            
    adoCon.Execute(strSQL)

    Set adoCon = Nothing
End If

%>

<html>
<head>
<!-- BR Enquete V.1 - Desenvolvido por Bruno Linhares - www.brdesign.net -->
<title> - Administração - Adicionar nova enquete</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="br_enquete_estilo.css" rel="stylesheet" type="text/css">
<body bgcolor="#FFFFFF" text="#000000" link="#0000CC" vlink="#0000CC" alink="#FF0000">
<div align="center">
  <h2>Adicionar nova enquete</h2>
  <p><br>
    <%
  If blnAddNewPoll = True Then
      Response.Write " Enquete criada com sucesso!"
  Else
      Response.Write "ERRO! Sua enquete não pôde se criada!<br><br><a href=""JavaScript:history.back(1)"">Tente novamente</a>"
  End If
  %>


Viewing all articles
Browse latest Browse all 1214