www.webdeveloper.com
Results 1 to 9 of 9

Thread: <%=user_name%> Help please!

Hybrid View

  1. #1
    Join Date
    Dec 2002
    Posts
    23

    <%=user_name%> Help please!

    Hello

    I have a form which, when sent, sends a copy to the Webmaster and e.mails (CDONTS) a copy to the person who filled in the form. A 'Thank you' HTML page also appears when the form is submitted.

    If possible I would like to personalise the 'Thank you' page, as in "Thanks Maria" but don't really want (or know how!!) to change or interfere with the variables I already have.

    In all, I have an email.asp file (which holds the form and calls the thanks page):

    <form name="name" method="POST" action="thanks.asp" etc,

    and the thanks.asp page which holds the CDONTS script and the variables:

    <%
    Dim t1name,t1,t2name,t2
    t1name = "name"
    t1 = Request.Form("t1")
    t2name = "email"
    t2 = Request.Form("t2")
    Dim stname,st
    stname = "comments"
    st = Request.Form("s1")
    Dim ObjMail
    Set ObjMail = Server.CreateObject("CDONTS.NewMail")
    ObjMail.To = "me@aol.com"
    ObjMail.CC = t2
    ObjMail.From = t2
    ObjMail.Subject = "Feedback"
    ObjMail.Body = t1name & vbcrlf&_
    t1 & vbcrlf&_
    t2name & vbcrlf&_
    t2 & vbcrlf&_
    stname & vbcrlf&_
    st
    ObjMail.Send
    Set ObjMail = Nothing
    %>

    I would be grateful for any ideas!

    Many thanks

    Quetzal

  2. #2
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    hi,
    try the code bellow, what i have done is used a technique called post back. What this does is posts you form back to the same page does all your CDONTS and then displays your custom thank you page.

    hope this helps

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <% val = request.form("val")
    if val = "" then
    %>
    <form action="/yourpage.asp" method="get">
    <table width="90%" border="0" cellspacing="0" cellpadding="4">
    <tr>
    <td>Name:</td>
    <td><input name="t1" type="text" id="t1"></td>
    </tr>
    <tr>
    <td>Email:</td>
    <td><input name="t2" type="text" id="t2"></td>
    </tr>
    <tr>
    <td>Message:</td>
    <td><textarea name="sl" id="sl"></textarea></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="Submit" value="Submit">
    <input name="val" type="hidden" id="val" value="yes"></td>
    </tr>
    </table>

    </form>
    <%else

    t1 = Request.Form("t1")
    t2 = Request.Form("t2")
    st = Request.Form("s1")
    Dim ObjMail
    Set ObjMail = Server.CreateObject("CDONTS.NewMail")
    ObjMail.To = "me@aol.com"
    ObjMail.CC = t2
    ObjMail.From = t2
    ObjMail.Subject = "Feedback"
    thebody = "Name:"&t1&"" & vbcrlf
    thebody = thebody & "Email: "&t2&"" & vbclf
    thebody = thebody & "Subject: "&t3&""
    ObjMail.Body = thebody
    ObjMail.Send
    Set ObjMail = Nothing

    %>
    <table width="90%" border="0" cellspacing="0" cellpadding="4">
    <tr>
    <td>Here is where you put your custom Thank you page and message to <%=t1%></td>
    </tr>
    </table>
    <%end if%>
    </body>
    </html>
    Last edited by Ribeyed; 01-29-2003 at 04:30 PM.
    ----------------------------------

  3. #3
    Join Date
    Dec 2002
    Posts
    23
    Hello SWR(Ribeyed)

    Thank you for your reply! Much appreciated!

    I have tried to go through the logic of it and attempted to customise it a little.

    I have two .asp files and have used almost all your code. This is script.asp:

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <% val = request.form("val")
    if val = "" then
    %>
    <form action="thankyou.asp" method="get">
    <table width="90%" border="0" cellspacing="0" cellpadding="4">
    <tr>
    <td>Name:</td>
    <td><input name="t1" type="text" id="t1"></td>
    </tr>
    <tr>
    <td>Email:</td>
    <td><input name="t2" type="text" id="t2"></td>
    </tr>
    <tr>
    <td>Message:</td>
    <td><textarea name="sl" id="sl"></textarea></td>
    </tr>
    <tr>
    <td> </td>
    <td><input type="submit" name="Submit" value="Submit">
    <input name="val" type="hidden" id="val" value="yes"></td>
    </tr>
    </table>

    </form>
    <%else

    t1 = Request.Form("t1")
    t2 = Request.Form("t2")
    st = Request.Form("s1")
    Dim ObjMail
    Set ObjMail = Server.CreateObject("CDONTS.NewMail")
    ObjMail.To = "mybox@aol.com"
    ObjMail.CC = t2
    ObjMail.From = t2
    ObjMail.Subject = "Feedback"
    thebody = "Name:"&t1&"" & vbcrlf
    thebody = thebody & "Email: "&t2&"" & vbclf
    thebody = thebody & "Subject: "&t3&""
    ObjMail.Body = thebody
    ObjMail.Send
    Set ObjMail = Nothing

    %>
    <table width="90%" border="0" cellspacing="0" cellpadding="4">
    <tr>
    <td>Thank you <%=t1%></td>
    </tr>
    </table>
    <%end if%>
    </body>
    </html>

    and in the second page, thankyou.asp, I have (less the html bits):

    <% @ Language=VBScript %>

    <% t1 = request.form("t1") %>


    <html>
    <head>
    <title>Thank you!</title>

    <p>Thank you <%=t1%></p>

    I am obviously doing something wrong, because the 'Thank you' page is not personalised, that it, it simply says: Thank you.

    And, no messages are send. neither the Webmaster, nor the site visitor (who should get a copy), recieves an e.mail.

    Can you see any glaring errors?

    Many thanks

    laTortuga

  4. #4
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    hi,
    Ok, try to understand you only need 1 page to do this task and not 2 pages.
    really the 1 page is the 2 pages combine if you read and follow then code you will see that either the form page is displayed or the customised thank you page. I have put in bold the fixes for the sending part.

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    -------In here you but your banners and navigation etc.-------
    <% val = request.form("val")
    if val = "" then
    %>
    <form action="thankyou.asp" method="get">
    <table width="90%" border="0" cellspacing="0" cellpadding="4">
    <tr>
    <td>Name:</td>
    <td><input name="t1" type="text" id="t1"></td>
    </tr>
    <tr>
    <td>Email:</td>
    <td><input name="t2" type="text" id="t2"></td>
    </tr>
    <tr>
    <td>Message:</td>
    <td><textarea name="sl" id="sl"></textarea></td>
    </tr>
    <tr>
    <td> </td>
    <td><input type="submit" name="Submit" value="Submit">
    <input name="val" type="hidden" id="val" value="yes"></td>
    </tr>
    </table>

    </form>
    <%else

    t1 = Request.Form("t1")
    t2 = Request.Form("t2")
    st = Request.Form("s1")
    Dim ObjMail
    Set ObjMail = Server.CreateObject("CDONTS.NewMail")
    ObjMail.To = "mybox@aol.com"
    ObjMail.CC = "&T2&"
    ObjMail.From = "&T2&"
    ObjMail.Subject = "Feedback"
    thebody = "Name:"&t1&"" & vbcrlf
    thebody = thebody & "Email: "&t2&"" & vbclf
    thebody = thebody & "Subject: "&t3&""
    ObjMail.Body = thebody
    ObjMail.Send
    Set ObjMail = Nothing

    %>
    ------------In this part here you add in your custom thank you page-------------------------------
    <table width="90%" border="0" cellspacing="0" cellpadding="4">
    <tr>
    <td>Thank you <%=t1%></td>
    </tr>
    </table>
    <%end if%>
    </body>
    </html>

    hope this helps.
    ----------------------------------

  5. #5
    Join Date
    Dec 2002
    Posts
    23

    Again, thanks!

    Hello [SWR]Ribeyed

    Many thanks agin for your reply.
    I have spent a good few hours over the weekend on it, and think I am just about there. I think it works!
    Many thanks again and best wishes
    laTortuga

  6. #6
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    good stuff
    ----------------------------------

  7. #7
    Join Date
    Feb 2003
    Location
    Sault Ste Marie, On, Canada
    Posts
    168
    Hey i've been looking at your code and I think you may be able to help me. I've come into the problem of auto response email. I've posted a thread on it but no one seems to be replying. With what you have here does the user who filled out the form get an email saying thank you or something. I am really lost on this issue of auto response email. Can you help me, on this.

  8. #8
    Join Date
    Dec 2002
    Posts
    23

    Calmarsis

    Hello Calmaris

    The visitor to the site completes the form (mane, e.mail address, and message). Clicks submit and a copy of the details (name, e.mail, and message) goes to the Webmaster.

    A copy of what the user has submitted is then e.mailed back to the user, just so that he has a copy of his form's details.

    Another page, if the form has been completed correctly, says 'Thank you + name' to the person who has filled in the form.

    Is that what you mean?

    laTortuga

  9. #9
    Join Date
    Feb 2003
    Location
    Sault Ste Marie, On, Canada
    Posts
    168
    Ya that's what I figured, thanks, someone posted some example code of how to go about doing it, So I now have a start thanks alot.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles