Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Mar 2011
    Posts
    96
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Conatct form .asp urgent help needed please

    Good Day:
    I have signed up with a web hosting company that will not give me any help with getting my contact form to work.
    I have acquired an .asp script from the hosting companies site and have adjusted it to were it works. My problem is that after the user hits the submit button, I want to take the viewer back to one of my html pages (home page)but I have no idea how to accomplish this. Can someone show me were and what to place in the below script that will take the user back to an html page after they have hit the submit button. I would be very gratefull.
    Shepard

    >ASP SCRIPT
    __________________
    <%
    '-----EDIT THE MAILING DETAILS IN THIS SECTION-----
    dim fromName, fromAddress, recipientName, recipientAddress, subject, body, sentTo

    fromName = Request.Form("Name")
    fromAddress = Request.Form("email")
    recipientName = "CLICK BROWSERS BACK BUTTON TO CONTINUE"
    recipientAddress= "shepard2@bellsouth.net"
    subject = "Website Contact Form"
    body = Request.Form("message")

    '-----YOU DO NOT NEED TO EDIT BELOW THIS LINE-----


    sentTo = "NOBODY"
    Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
    Mailer.FromName = fromName
    Mailer.FromAddress = fromAddress
    Mailer.RemoteHost = "mrelay.perfora.net"
    if Mailer.AddRecipient (recipientName, recipientAddress) then
    sentTo=recipientName & " (" & recipientAddress & ")"
    end if
    Mailer.Subject = subject
    Mailer.BodyText = body
    if Mailer.SendMail then
    Response.Write "YOUR MESSAGE HAS BEEN SENT: <b>" & sentTo & "</b>"
    else
    Response.Write "YOU MUST ENTER YOUR EMAIL ADDRESS. PRESS BACK BUTTON. Error was " & Mailer.Response
    end if
    %>




    HTML CONTACT FORM:
    ________________________


    <form method="post" action="http://shepard.com/sendmail2.asp ">
    <p align=center>Your Name:<input type="text"size="35"name="Name"></p>
    <p align=center>Your E-Mail:<input type="text"size="35"name="email"></p>
    <p align=center>Your Message:<br/>
    <textarea rows="8"cols="40"name="message"></textarea></p>
    <p align=center><input type="submit" /></p>
    </form>
    </div>

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,698
    Thanks
    80
    Thanked 4,511 Times in 4,475 Posts
    Just use Response.Redirect "thePageYouWant.html"

    But you can *NOT* do that *AND* do Response.Write.

    So what I might do is this:
    Code:
    if Mailer.SendMail then
        Response.Redirect "thePage.html"
    else
        Response.Write "YOU MUST ENTER YOUR EMAIL ADDRESS. PRESS BACK BUTTON. Error was " & Mailer.Response
    end if
    at the end of that instead of what is there.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    SHEPME (11-11-2011)

  • #3
    New Coder
    Join Date
    Mar 2011
    Posts
    96
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Hello, Old Pedant:
    I tried what you told me to do but it still does not work. After the viewer fills out my contact form and hits the submit button, I want them to go to one of my web pages that thanks them. I have the code that I am using below. What an I doing wrong?
    Thanks
    Shepard

    <%
    '-----EDIT THE MAILING DETAILS IN THIS SECTION-----
    dim fromName, fromAddress, recipientName, recipientAddress, subject, body, sentTo

    fromName = Request.Form("Name")
    fromAddress = Request.Form("email")
    recipientName = "Your Name Goes Here"
    recipientAddress= "shepme@bellsouth.net"
    subject = "Enter a Subject Title Here!"
    body = Request.Form("message")

    '-----YOU DO NOT NEED TO EDIT BELOW THIS LINE-----


    sentTo = "NOBODY"
    Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
    Mailer.FromName = fromName
    Mailer.FromAddress = fromAddress
    Mailer.RemoteHost = "mrelay.perfora.net"
    if Mailer.AddRecipient (recipientName, recipientAddress) then
    sentTo=recipientName & " (" & recipientAddress & ")"
    end if
    Mailer.Subject = subject
    Mailer.BodyText = body
    if Mailer.SendMail then
    Response.redirect "thank.htm" <b>" & sentTo & "</b>"
    else
    Response.Write "Mail send failure. Error was " & Mailer.Response
    end if
    %>

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,698
    Thanks
    80
    Thanked 4,511 Times in 4,475 Posts
    This makes no sense:
    Code:
    Response.redirect "thank.htm" <b>" & sentTo & "</b>"
    (1) You have 5 " marks there. " marks *ALWAYS come in pairs.
    (2) You don't have any & after "thank.htm"
    (3) Even if you did, that's not a legal URL. Response.Redirect *REQUIRES* a *LEGAL* url. Period. URLs are *NOT* allowed to have <b>....</b> in them.

    If you want the name of the person to appear on the thank you page, then you should make it an ASP page, instead:
    Code:
    Response.redirect "thank.asp?name=" & Escape(sentTo)
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    New Coder
    Join Date
    Mar 2011
    Posts
    96
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    This makes no sense:
    Code:
    Response.redirect "thank.htm" <b>" & sentTo & "</b>"
    (1) You have 5 " marks there. " marks *ALWAYS come in pairs.
    (2) You don't have any & after "thank.htm"
    (3) Even if you did, that's not a legal URL. Response.Redirect *REQUIRES* a *LEGAL* url. Period. URLs are *NOT* allowed to have <b>....</b> in them.

    If you want the name of the person to appear on the thank you page, then you should make it an ASP page, instead:
    Code:
    Response.redirect "thank.asp?name=" & Escape(sentTo)
    Good Morning: OP
    Thanks for your help, however I am still lost. I have a website that has a navigation menu. One of the links on the menu is a contact link. When the viewer clicks on that link they can fill out a contact form. When they hit the send button I want them taken back to one of my web pages that has that navigation menu so they can continue to view my website. I dont want to use another .asp as it just gives the viewer a white page with writing on it.
    I am somewhat ok with html but know nothing about .asp scripts. Would you be kind enough to look at this script and tell me what I need to do so that after the viewer hits submit it takes them back to one of my html pages.
    I have no idea what you are talking about in regards to<b>" & sentTo & "</b>". As I mentioned above I have no idea how to write code. Here is what I am using now. After the user hits submit it just displays "use your browsers back button to return to site"
    Thanks very much for your help
    Shepard

    <%
    '-----EDIT THE MAILING DETAILS IN THIS SECTION-----
    dim fromName, fromAddress, recipientName, recipientAddress, subject, body, sentTo

    fromName = Request.Form("Name")
    fromAddress = Request.Form("email")
    recipientName = "Your Name Goes Here"
    recipientAddress= "shepme@bellsouth.net"
    subject = "Enter a Subject Title Here!"
    body = Request.Form("message")

    '-----YOU DO NOT NEED TO EDIT BELOW THIS LINE-----


    sentTo = "NOBODY"
    Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
    Mailer.FromName = fromName
    Mailer.FromAddress = fromAddress
    Mailer.RemoteHost = "mrelay.perfora.net"
    if Mailer.AddRecipient (recipientName, recipientAddress) then
    sentTo=recipientName & " (" & recipientAddress & ")"
    end if
    Mailer.Subject = subject
    Mailer.BodyText = body
    if Mailer.SendMail then
    Response.redirect "thank.htm" <b>" & sentTo & "</b>"
    else
    Response.Write "Mail send failure. Error was " & Mailer.Response
    end if
    %>

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,698
    Thanks
    80
    Thanked 4,511 Times in 4,475 Posts
    Then just change this line:
    Code:
    Response.redirect "thank.htm" <b>" & sentTo & "</b>"
    to redirect to a *LEGAL* URL.

    Read what I wrote.

    If you can't do anything else, then just do
    Code:
    Response.Redirect "thank.htm"
    But if all you get from ASP pages are a white screen, then why do you think ASP is working, at all, on your server?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #7
    New Coder
    Join Date
    Mar 2011
    Posts
    96
    Thanks
    7
    Thanked 0 Times in 0 Posts
    I did not mean a BLANK white screen. I meant that it is not proffessional and it is boring. I just want to get the viewer back to one of my web pages after the form is sent. Thats all.

  • #8
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,698
    Thanks
    80
    Thanked 4,511 Times in 4,475 Posts
    You know, if you simply rename one of your HTML pages to ".asp", then you will have all the content currently on the HTML page *AND* you will have the ability to add dynamic ASP content.

    But that's up to you.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #9
    New Coder
    Join Date
    Mar 2011
    Posts
    96
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    Then just change this line:
    Code:
    Response.redirect "thank.htm" <b>" & sentTo & "</b>"
    to redirect to a *LEGAL* URL.

    Read what I wrote.

    If you can't do anything else, then just do
    Code:
    Response.Redirect "thank.htm"
    But if all you get from ASP pages are a white screen, then why do you think ASP is working, at all, on your server?
    Good morning:
    I have tried what you told me to do and it is not working.
    When I press the submit button, I get an error message that says ""YOU MUST ENTER YOUR EMAIL ADDRESS. PRESS BACK BUTTON. Error was"

    Here is the code. Any idea what I could be doing wrong.


    <%
    '-----EDIT THE MAILING DETAILS IN THIS SECTION-----
    dim fromName, fromAddress, recipientName, recipientAddress, subject, body, sentTo

    fromName = Request.Form("Name")
    fromAddress = Request.Form("email")
    recipientName = "CLICK BROWSERS BACK BUTTON TO CONTINUE"
    recipientAddress= "test@bellsouth.net"
    subject = "Website Contact Form"
    body = Request.Form("message")

    '-----YOU DO NOT NEED TO EDIT BELOW THIS LINE-----


    sentTo = "NOBODY"
    Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
    Mailer.FromName = fromName
    Mailer.FromAddress = fromAddress
    Mailer.RemoteHost = "mrelay.perfora.net"
    if Mailer.AddRecipient (recipientName, recipientAddress) then
    sentTo=recipientName & " (" & recipientAddress & ")"
    end if
    Mailer.Subject = subject
    Mailer.BodyText = body
    if Mailer.SendMail then
    Response.redirect "http://www.test.com/thank.htm"
    else
    Response.Write "YOU MUST ENTER YOUR EMAIL ADDRESS. PRESS BACK BUTTON. Error was " & Mailer.Response
    end if
    %>

  • #10
    New Coder
    Join Date
    Mar 2011
    Posts
    96
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Old Pedant: Sorry. I deleted from the server and uploaded it again and now it is working. I have no idea why.
    Anyhow, thanks for your help.
    Shep


  •  

    Posting Permissions

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