Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Contact page problem

Options
  • 03-07-2002 11:04am
    #1
    Closed Accounts Posts: 570 ✭✭✭


    I'm trying to put a contact form together, where visitors input contact names, email, tel etc.

    I followed the htmlgoodies tutorial. However, when i click on the submit button my outlook express kicks in and the info is not sent to email account.

    Do i need to use some Perl or java script code?

    any thoughts anyone.
    Thanks


Comments

  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Sounds like your Form ACTION is a 'mailto' rather than submitting to a server-side script.

    Still, post your code, we're not clairvoyant.


  • Closed Accounts Posts: 570 ✭✭✭manonthemoon


    Think you could be right Corinthian. here is the code anyway




    <CAPTION> 
    <FORM action="mailto:bocjobs@yahoo.co.uk" ?method="POST">
    <P>
    <INPUT name=recipient type=hidden value=bocjobs@yahoo.co.uk>
    <INPUT name=redirect type=hidden
    value=thankyou.html>
    <INPUT name=required type=hidden
    value="Check in month,Check in day,Number in party,First name,Surname,Address1,City_County,Country,email,Telephone">

    </P>
    <CENTER>...........................................................................


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    You've done a cut 'n paste of a form that was originally meant submit to a server side script. The ACTION should point to that and you'll need that script (there are various free form2email scripts out there) on the server.

    Also, your server will have to support the scripting technology you intend on using.

    My advice is that if you don't understand the difference between server and client side scripting (my guess is not really). That you should start there as it'll be a lot easier to implement what your after if you do.


  • Registered Users Posts: 11,987 ✭✭✭✭zAbbo


    if its in asp try this
    <%@LANGUAGE="VBSCRIPT"%>
    <%
    	if Request.Form("FFSubmitted") = "yes" then
    		Dim BodyString
    		Dim objCDO
    		Dim RedirectURL
    		Dim FormFields
    		Dim arrFormFields
    			FormFields = "Subject~Message~Phone~Name~Address~Email"
    			If FormFields <> "" Then
    				arrFormFields = split(FormFields,"~")
    			End If
    	        Set objCDO = Server.CreateObject("CDONTS.NewMail") 
    			objCDO.From = "contact@yoursite.com"
    			objCDO.To = "yourname@here.com"
    			objCDO.Cc = ""
    			objCDO.Bcc = ""
    			objCDO.Subject = "Contact Form fom Your Site"	
    			BodyString =  Replace("~The following information was sent from the contact page on your site","~",chr(13) & chr(10) )& chr(13)
    			If FormFields <> "" Then
    				For Each item In arrFormFields
    					BodyString = BodyString & item & ": " & Request.Form(item) & chr(13)
    				Next
    			End If
    			objCDO.Body = BodyString
    			objCDO.BodyFormat = 1
    			objCDO.MailFormat = 1
    			objCDO.Send
    			Set objCDO = Nothing
    			RedirectURL = "thankyou.asp" 
    			If RedirectURL <> "" then 
    				If Request.QueryString <> "" Then
      					response.redirect(RedirectURL & "?" & Request.QueryString)
    				else
    					response.redirect(RedirectURL)
    				end If
    			end if
    	end if
    %>
    
    

    You must insert the Code in the asp page and have a form containing Subject~Message~Phone~Name~Address~Email fields or whatever you require. Also the
    RedirectURL = "thankyou.asp" refers to the page that will be shown when the user submits the form.
    The form name for this example was form1. I also have the form code should you require it for completeness.

    Regards


  • Closed Accounts Posts: 570 ✭✭✭manonthemoon


    Thanks Baz


  • Advertisement
Advertisement