Visualizzazione dei risultati da 1 a 2 su 2

Discussione: form in asp

  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2005
    Messaggi
    89

    form in asp

    Ciao ragazzi qualcuno sa postarmi un codice per fare una form in asp dove il cliente inserisce nome cognome,scrive il messaggio e a me arriva tutto sulla mia personale?Vi ringrazio!
    P.S. ho il server che lavora con cdonts

  2. #2
    Pagina modulo invio "messaggio.asp"
    codice:
    <%@LANGUAGE="VBSCRIPT"%>
    <%
    	If (cStr(Request("Submit")) <> "") Then
    	If (Request("varFrom") <> "" AND Request("Subject") <> "" AND Request("Message") <> "") Then 
    	Dim objCDO
    	Set objCDO = Server.CreateObject("CDONTS.NewMail")
    	objCDO.From = cStr(Request("varFrom")) 'Indirizzo email dello scrivente
    	objCDO.To = "webmaster@tuosito.org" 'Qui l'indirizzo email del webmaster del sito
    	objCDO.Subject = cStr(Request("Subject"))'Oggetto dell'email
    	objCDO.Body = cStr(Request("Message")) 'Messaggio email
    	objCDO.Send() 'send mail
    	Set objCDO = Nothing 'Clean up your objects!!!
    	Response.Redirect("grazie.asp") 'Pagina di ringraziamento
    	'Response.Write("Message Delivered") 
    	else Server.Transfer "errore.asp"
    	end if
    End If
    %>
    <html>
    <head>
    <title>invio posta</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" href="stile.css" type="text/css">
    </head>
    
    <body bgcolor="#FFFFFF" text="#000000">
    <table border="0" cellspacing="0" cellpadding="0" class="testo2">
      
      <tr> 
        <td> 
          <form name="CDO_Email_Form" method="post" action="">
            <table class="testo2">
              <tr> 
                <td>Da</td>
                <td> 
                  <input type="text" name="varFrom" size="50">
                </td>
              </tr>
              <tr> 
                <td>Subject</td>
                <td> 
                  <input type="text" name="Subject" size="50">
                </td>
              </tr>
              <tr> 
                <td>Message</td>
                <td> 
                  <textarea name="Message" cols="50" rows="5"></textarea>
                </td>
              </tr>
              <tr> 
                <td colspan="2"> 
                  <p align="center"> 
                  <input type="submit" name="Submit" value="Invia email">
                </td>
              </tr>
            </table>
          </form>
        </td>
      </tr>
    </table>
    </body>
    </html>
    Pagina di ringraziamento "grazie.asp"
    codice:
    <html>
    <head>
    <title>grazie</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" href="stile.css" type="text/css">
    </head>
    
    <body bgcolor="#FFFFFF" text="#000000">
    <table width="562" border="0" cellspacing="0" cellpadding="0" align="center" class="testo2">
      <tr> 
        <td width="562"></td>
      </tr>
      <tr> 
        <td width="562" align="center"> 
          
    
    Il messaggio &egrave; stato spedito correttamente</p>
          
    
    grazie!</p>
        </td>
      </tr>
      <tr> 
        <td width="562"></td>
      </tr>
    </table>
    </body>
    </html>
    Pagina controllo "errore.asp"
    codice:
    <%@LANGUAGE="VBSCRIPT"%>
    <html>
    <head>
    <title>errore</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" href="stile.css" type="text/css">
    </head>
    
    <body bgcolor="#FFFFFF" text="#000000">
    
    
    </p>
    <table width="500" border="0" cellspacing="0" cellpadding="0" align="center" class="testo2">
      <tr> 
        <td align="center"> 
          
    
    Il Messaggio non &egrave; stato inviato perch&egrave; ci sono i seguenti 
            errori </p>
          
    
    </p>
        </td>
      </tr>
      <tr> 
        <td align="center"> <font color="#990000"> 
          <% If Request("varFrom") = "" Then %>
          <% Response.Write "Devi inserire il mittente" %>
          <% end if %>
          </font></td>
      </tr>
      <tr> 
        <td align="center"><font color="#990000"></font></td>
      </tr>
      <tr> 
        <td align="center"> <font color="#990000"> 
          <% If Request("Subject") = "" Then %>
          <% Response.Write "Devi inserire l'oggetto" %>
          <% end if %>
          </font></td>
      </tr>
      <tr> 
        <td align="center"><font color="#990000"></font></td>
      </tr>
      <tr> 
        <td align="center"> <font color="#990000"> 
          <% If Request("Message") = "" Then %>
          <% Response.Write "Devi inserire il messaggio" %>
          <% end if %>
          </font></td>
      </tr>
    </table>
    
    
    </p>
    </body>
    </html>
    Devi solo sostituire nella riga
    objCDO.To = "webmaster@tuosito.org"
    il tuo indirizzo email

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.