Avatar billede praktikanten Nybegynder
20. februar 2005 - 17:54 Der er 11 kommentarer

Kode spiller ik

Hej,

Hvad skal der til for at denne her kode spiller. Umiddelbart viser den ikke den tabel hvor mine forms ligger i. Og så ved jeg ikke hvordan jeg skal skrive linket i min formaction for at den skal smide det i databasen.

På forhånd tak

---------------------------------------------------
<%

 
    topic = replace(request.form("topic"),"'","''")
    body = replace(request.form("body"),"'","''")
    bodyStr = replace(body,vbcrlf,"<br>")
    author = request.form("nick")
    email = request.form("email")
  website = request.form("website")
 
    err = 0

    if author = "" then
    err = 1
    errormsg = "<br>Du skal skrive dit nick"
    end if

    if instr(email,"@") = 0 or instr(email,".") = 0 or email = "" then
    err = 1
    errormsg = errormsg + "<br>Email-adressen er ikke gyldig"
    end if

    if topic = "" then
    err = 1
    errormsg = errormsg + "<br>Du skal skrive et emne"
    end if

    if body = "" then
    err = 1
    errormsg = errormsg + "<br>Du skal skrive et tag :P"
    end if

    if err = 0 then

    SQL = "insert into tagwall(author, website, email, topic, body, ip) values('"
    SQL = SQL & author & "','"
    SQL = SQL & email & "','"
    SQL = SQL & topic & "','"
    SQL = SQL & bodyStr & "','"

    SQL = SQL & Request.ServerVariables("REMOTE_ADDR") & "')"

    set RSinsert = conn.Execute(SQL)

    if request.form("remember") = "true" then
    Response.cookies("nick") = author
    Response.Cookies("nick").Expires = Date+365
    Response.cookies("email") = email
    Response.Cookies("email").Expires = Date+365
    end if

    response.redirect("http://www.team-nopanic.dk/pages/communication.asp")

%>
         
      response.write("<form name="form1" method="post" action="communication.asp"><input type="hidden" name="mode" value="insert">")
         
              <table width="545" cellpadding="5" class="updown">
                <tr>
                  <td width="167">Dit navn: <span class="style1">*</span> </td>
                  <td width="350"><input name="author" type="text"  value="<% response.write(" "& RS("author")&" ")%>" class="textfield"></td>
                </tr>
                <tr>
                  <td>Din email: <span class="style1">*</span> </td>
                  <td><input name="email" type="text" class="textfield" id="email" value="<% response.write(" "& RS("email")&" ")%>"></td>
                </tr>
                <tr>
                  <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="text10">
                      <tr>
                        <td width="130">Dit website: </td>
                        <td width="37"><span class="style4">http://</span></td>
                      </tr>
                    </table></td>
                  <td><input name="website" type="text"  class="textfield" id="website" value="<% response.write(" "& RS("website")&" ")%>"></td>
                </tr>
                <tr>
                  <td>Overskrift: <span class="style1">*</span></td>
                  <td><input name="topic" type="text"  class="textfield" id="topic"  value="<% response.write(" "& RS("topic")&" ")%>"></td>
                </tr>
                <tr>
                  <td valign="top">Indl&aelig;g: <span class="style1">*</span></td>
                  <td><textarea name="body" class="textbox" id="body"  value="<% response.write(" "& RS("body")&" ")%>"></textarea></td>
                </tr>
                <tr><%response.write(" "&errormsg&"")%>
                  <td height="37" valign="middle">Husk info<br>
                      <span class="style3">(Cookies)</span></td>
                  <td valign="top"><input type="checkbox" name="remember" value="true">
                  </td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td><input name="Submit" type="submit" class="agree" value="Tilf&oslash;j indl&aelig;g"></td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
              </table>
              <br></td>
          </tr>
        </table>
          </td>
      </tr>
    </table>
    <%end if%>
Avatar billede ellebaek Nybegynder
20. februar 2005 - 21:07 #1
<%

if request.form("mode") = "insert" then
    topic = replace(request.form("topic"),"'","''")
    body = replace(request.form("body"),"'","''")
    bodyStr = replace(body,vbcrlf,"<br>")
    author = request.form("nick")
    email = request.form("email")
    website = request.form("website")

    err = 0

    if author = "" then
    err = 1
    errormsg = "<br>Du skal skrive dit nick"
    end if

    if instr(email,"@") = 0 or instr(email,".") = 0 or email = "" then
    err = 1
    errormsg = errormsg + "<br>Email-adressen er ikke gyldig"
    end if

    if topic = "" then
    err = 1
    errormsg = errormsg + "<br>Du skal skrive et emne"
    end if

    if body = "" then
    err = 1
    errormsg = errormsg + "<br>Du skal skrive et tag :P"
    end if

    if err = 0 then

    SQL = "insert into tagwall(author, website, email, topic, body, ip) values('"
    SQL = SQL & author & "','"
    SQL = SQL & email & "','"
    SQL = SQL & topic & "','"
    SQL = SQL & bodyStr & "','"

    SQL = SQL & Request.ServerVariables("REMOTE_ADDR") & "')"

    set RSinsert = conn.Execute(SQL)

    if request.form("remember") = "true" then
    Response.cookies("nick") = author
    Response.Cookies("nick").Expires = Date+365
    Response.cookies("email") = email
    Response.Cookies("email").Expires = Date+365
    end if

    response.redirect("http://www.team-nopanic.dk/pages/communication.asp")
end if
end if
%>
       
      response.write("<form name="form1" method="post" action="communication.asp"><input type="hidden" name="mode" value="insert">")
       
              <table width="545" cellpadding="5" class="updown">
                <tr>
                  <td width="167">Dit navn: <span class="style1">*</span> </td>
                  <td width="350"><input name="author" type="text"  value="<% response.write(" "& RS("author")&" ")%>" class="textfield"></td>
                </tr>
                <tr>
                  <td>Din email: <span class="style1">*</span> </td>
                  <td><input name="email" type="text" class="textfield" id="email" value="<% response.write(" "& RS("email")&" ")%>"></td>
                </tr>
                <tr>
                  <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="text10">
                      <tr>
                        <td width="130">Dit website: </td>
                        <td width="37"><span class="style4">http://</span></td>
                      </tr>
                    </table></td>
                  <td><input name="website" type="text"  class="textfield" id="website" value="<% response.write(" "& RS("website")&" ")%>"></td>
                </tr>
                <tr>
                  <td>Overskrift: <span class="style1">*</span></td>
                  <td><input name="topic" type="text"  class="textfield" id="topic"  value="<% response.write(" "& RS("topic")&" ")%>"></td>
                </tr>
                <tr>
                  <td valign="top">Indl&aelig;g: <span class="style1">*</span></td>
                  <td><textarea name="body" class="textbox" id="body"  value="<% response.write(" "& RS("body")&" ")%>"></textarea></td>
                </tr>
                <tr><%response.write(" "&errormsg&"")%>
                  <td height="37" valign="middle">Husk info<br>
                      <span class="style3">(Cookies)</span></td>
                  <td valign="top"><input type="checkbox" name="remember" value="true">
                  </td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td><input name="Submit" type="submit" class="agree" value="Tilf&oslash;j indl&aelig;g"></td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
              </table>
              <br></td>
          </tr>
        </table>
          </td>
      </tr>
    </table>

sådan her..
Så burde den vise formen..

men du skal lige kigge på din redirect.
hvad hedder den side hvor formen ligger ?
og hvilken side skal du redirecte til..?
Avatar billede praktikanten Nybegynder
20. februar 2005 - 22:04 #2
Nu viser den da lidt mere. Men den ser stadig sjov ud :)
http://www.team-nopanic.dk/pages/addtag.asp
Avatar billede ellebaek Nybegynder
20. februar 2005 - 23:05 #3
ja, det var ikk pænt..

Sådan her:

<%

if request.form("mode") = "insert" then
    topic = replace(request.form("topic"),"'","''")
    body = replace(request.form("body"),"'","''")
    bodyStr = replace(body,vbcrlf,"<br>")
    author = request.form("nick")
    email = request.form("email")
    website = request.form("website")

    err = 0

    if author = "" then
    err = 1
    errormsg = "<br>Du skal skrive dit nick"
    end if

    if instr(email,"@") = 0 or instr(email,".") = 0 or email = "" then
    err = 1
    errormsg = errormsg + "<br>Email-adressen er ikke gyldig"
    end if

    if topic = "" then
    err = 1
    errormsg = errormsg + "<br>Du skal skrive et emne"
    end if

    if body = "" then
    err = 1
    errormsg = errormsg + "<br>Du skal skrive et tag :P"
    end if

    if err = 0 then

    SQL = "insert into tagwall(author, website, email, topic, body, ip) values('"
    SQL = SQL & author & "','"
    SQL = SQL & email & "','"
    SQL = SQL & topic & "','"
    SQL = SQL & bodyStr & "','"

    SQL = SQL & Request.ServerVariables("REMOTE_ADDR") & "')"

    set RSinsert = conn.Execute(SQL)

    if request.form("remember") = "true" then
    Response.cookies("nick") = author
    Response.Cookies("nick").Expires = Date+365
    Response.cookies("email") = email
    Response.Cookies("email").Expires = Date+365
    end if

    response.redirect("http://www.team-nopanic.dk/pages/communication.asp")
end if
end if

     
      response.write("<form name="form1" method="post" action="communication.asp"><input type="hidden" name="mode" value="insert">")
%>     
              <table width="545" cellpadding="5" class="updown">
                <tr>
                  <td width="167">Dit navn: <span class="style1">*</span> </td>
                  <td width="350"><input name="author" type="text"  value="<% response.write(" "& RS("author")&" ")%>" class="textfield"></td>
                </tr>
                <tr>
                  <td>Din email: <span class="style1">*</span> </td>
                  <td><input name="email" type="text" class="textfield" id="email" value="<% response.write(" "& RS("email")&" ")%>"></td>
                </tr>
                <tr>
                  <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="text10">
                      <tr>
                        <td width="130">Dit website: </td>
                        <td width="37"><span class="style4">http://</span></td>
                      </tr>
                    </table></td>
                  <td><input name="website" type="text"  class="textfield" id="website" value="<% response.write(" "& RS("website")&" ")%>"></td>
                </tr>
                <tr>
                  <td>Overskrift: <span class="style1">*</span></td>
                  <td><input name="topic" type="text"  class="textfield" id="topic"  value="<% response.write(" "& RS("topic")&" ")%>"></td>
                </tr>
                <tr>
                  <td valign="top">Indl&aelig;g: <span class="style1">*</span></td>
                  <td><textarea name="body" class="textbox" id="body"  value="<% response.write(" "& RS("body")&" ")%>"></textarea></td>
                </tr>
                <tr><%response.write(" "&errormsg&"")%>
                  <td height="37" valign="middle">Husk info<br>
                      <span class="style3">(Cookies)</span></td>
                  <td valign="top"><input type="checkbox" name="remember" value="true">
                  </td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td><input name="Submit" type="submit" class="agree" value="Tilf&oslash;j indl&aelig;g"></td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
              </table>
              <br></td>
          </tr>
        </table>
          </td>
      </tr>
    </table>
Avatar billede ellebaek Nybegynder
20. februar 2005 - 23:08 #4
men det skal nok nærmere være noget i den her stil..

<%

if request.form("mode") = "insert" then
    topic = replace(request.form("topic"),"'","''")
    body = replace(request.form("body"),"'","''")
    bodyStr = replace(body,vbcrlf,"<br>")
    author = request.form("nick")
    email = request.form("email")
    website = request.form("website")

    err = 0

    if author = "" then
    err = 1
    errormsg = "<br>Du skal skrive dit nick"
    end if

    if instr(email,"@") = 0 or instr(email,".") = 0 or email = "" then
    err = 1
    errormsg = errormsg + "<br>Email-adressen er ikke gyldig"
    end if

    if topic = "" then
    err = 1
    errormsg = errormsg + "<br>Du skal skrive et emne"
    end if

    if body = "" then
    err = 1
    errormsg = errormsg + "<br>Du skal skrive et tag :P"
    end if

    if err = 0 then

    SQL = "insert into tagwall(author, website, email, topic, body, ip) values('"
    SQL = SQL & author & "','"
    SQL = SQL & email & "','"
    SQL = SQL & topic & "','"
    SQL = SQL & bodyStr & "','"

    SQL = SQL & Request.ServerVariables("REMOTE_ADDR") & "')"

    set RSinsert = conn.Execute(SQL)

    if request.form("remember") = "true" then
    Response.cookies("nick") = author
    Response.Cookies("nick").Expires = Date+365
    Response.cookies("email") = email
    Response.Cookies("email").Expires = Date+365
    end if

    response.redirect("http://www.team-nopanic.dk/pages/communication.asp")
end if
end if

   
      response.write("<form name="form1" method="post" action="addtag.asp"><input type="hidden" name="mode" value="insert">")
%>   
              <table width="545" cellpadding="5" class="updown">
                <tr>
                  <td width="167">Dit navn: <span class="style1">*</span> </td>
                  <td width="350"><input name="author" type="text" class="textfield"></td>
                </tr>
                <tr>
                  <td>Din email: <span class="style1">*</span> </td>
                  <td><input name="email" type="text" class="textfield" id="email"></td>
                </tr>
                <tr>
                  <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="text10">
                      <tr>
                        <td width="130">Dit website: </td>
                        <td width="37"><span class="style4">http://</span></td>
                      </tr>
                    </table></td>
                  <td><input name="website" type="text"  class="textfield" id="website"></td>
                </tr>
                <tr>
                  <td>Overskrift: <span class="style1">*</span></td>
                  <td><input name="topic" type="text"  class="textfield" id="topic"></td>
                </tr>
                <tr>
                  <td valign="top">Indl&aelig;g: <span class="style1">*</span></td>
                  <td><textarea name="body" class="textbox" id="body"></textarea></td>
                </tr>
                <tr><%response.write(" "&errormsg&"")%>
                  <td height="37" valign="middle">Husk info<br>
                      <span class="style3">(Cookies)</span></td>
                  <td valign="top"><input type="checkbox" name="remember" value="true">
                  </td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td><input name="Submit" type="submit" class="agree" value="Tilf&oslash;j indl&aelig;g"></td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
              </table>
              <br></td>
          </tr>
        </table>
          </td>
      </tr>
    </table>
Avatar billede praktikanten Nybegynder
21. februar 2005 - 18:01 #5
Nu kan jeg se hvad der står :)
Men når jeg taster mine oplysninger ind og trykker på send. Så siger den jeg skal indtaste mit nick
Avatar billede ellebaek Nybegynder
21. februar 2005 - 20:26 #6
<%

if request.form("mode") = "insert" then
    topic = replace(request.form("topic"),"'","''")
    body = replace(request.form("body"),"'","''")
    bodyStr = replace(body,vbcrlf,"<br>")
    author = request.form("author")
    email = request.form("email")
    website = request.form("website")

    err = 0

    if author = "" then
    err = 1
    errormsg = "<br>Du skal skrive dit nick"
    end if

    if instr(email,"@") = 0 or instr(email,".") = 0 or email = "" then
    err = 1
    errormsg = errormsg + "<br>Email-adressen er ikke gyldig"
    end if

    if topic = "" then
    err = 1
    errormsg = errormsg + "<br>Du skal skrive et emne"
    end if

    if body = "" then
    err = 1
    errormsg = errormsg + "<br>Du skal skrive et tag :P"
    end if

    if err = 0 then

    SQL = "insert into tagwall(author, website, email, topic, body, ip) values('"
    SQL = SQL & author & "','"
    SQL = SQL & email & "','"
    SQL = SQL & topic & "','"
    SQL = SQL & bodyStr & "','"

    SQL = SQL & Request.ServerVariables("REMOTE_ADDR") & "')"

    set RSinsert = conn.Execute(SQL)

    if request.form("remember") = "true" then
    Response.cookies("nick") = author
    Response.Cookies("nick").Expires = Date+365
    Response.cookies("email") = email
    Response.Cookies("email").Expires = Date+365
    end if

    response.redirect("http://www.team-nopanic.dk/pages/communication.asp")
end if
end if

   
      response.write("<form name="form1" method="post" action="addtag.asp"><input type="hidden" name="mode" value="insert">")
%>   
              <table width="545" cellpadding="5" class="updown">
                <tr>
                  <td width="167">Dit navn: <span class="style1">*</span> </td>
                  <td width="350"><input name="author" type="text" class="textfield"></td>
                </tr>
                <tr>
                  <td>Din email: <span class="style1">*</span> </td>
                  <td><input name="email" type="text" class="textfield" id="email"></td>
                </tr>
                <tr>
                  <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="text10">
                      <tr>
                        <td width="130">Dit website: </td>
                        <td width="37"><span class="style4">http://</span></td>
                      </tr>
                    </table></td>
                  <td><input name="website" type="text"  class="textfield" id="website"></td>
                </tr>
                <tr>
                  <td>Overskrift: <span class="style1">*</span></td>
                  <td><input name="topic" type="text"  class="textfield" id="topic"></td>
                </tr>
                <tr>
                  <td valign="top">Indl&aelig;g: <span class="style1">*</span></td>
                  <td><textarea name="body" class="textbox" id="body"></textarea></td>
                </tr>
                <tr><%response.write(" "&errormsg&"")%>
                  <td height="37" valign="middle">Husk info<br>
                      <span class="style3">(Cookies)</span></td>
                  <td valign="top"><input type="checkbox" name="remember" value="true">
                  </td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td><input name="Submit" type="submit" class="agree" value="Tilf&oslash;j indl&aelig;g"></td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
              </table>
              <br></td>
          </tr>
        </table>
          </td>
      </tr>
    </table>

sådan her, der var lige en fejl i et form navn..
Avatar billede praktikanten Nybegynder
21. februar 2005 - 21:52 #7
ADODB.Connection.1 error '80004005'

SQLState: 42000
Native Error Code: 1064
[TCX][MyODBC]You have an error in your SQL syntax near ''' at line 1


/pages/addtag.asp, line 104

Hvad er fejlen der ?
Avatar billede praktikanten Nybegynder
25. februar 2005 - 21:30 #8
Tror du at du kan hjælpe mig det sidste stykke vej. Jeg hæver gerne point-tallet!
Avatar billede praktikanten Nybegynder
26. februar 2005 - 15:34 #9
Hvis du lige vil være venlig at fortælle mig om du kan hjælpe mig den sidste vej. Ellers lukker jeg spm, og åbner igen!
Avatar billede ellebaek Nybegynder
03. marts 2005 - 22:12 #10
sorry.. har ikke været ved en computer længe..

men den der fejl, har jeg ikke rigtig set før, men det tyder på at det er en alm syntax fejl..

prøv at rette dette:
SQL = "insert into tagwall(author, website, email, topic, body, ip) values('"
    SQL = SQL & author & "','"
    SQL = SQL & email & "','"
    SQL = SQL & topic & "','"
    SQL = SQL & bodyStr & "','"

    SQL = SQL & Request.ServerVariables("REMOTE_ADDR") & "')"

    set RSinsert = conn.Execute(SQL)
til:
SQL = "insert into tagwall(author, website, email, topic, body, ip) values('"
    SQL = SQL & author & "','"
    SQL = SQL & email & "','"
    SQL = SQL & topic & "','"
    SQL = SQL & bodyStr & "','"

    SQL = SQL & Request.ServerVariables("REMOTE_ADDR") & "')"

response.write SQL
response.end
    set RSinsert = conn.Execute(SQL)
Avatar billede praktikanten Nybegynder
04. marts 2005 - 11:55 #11
http://www.team-nopanic.dk/pages/addtag.asp
prøv at udfylde felter nu og se hvordan det opfører sig
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester