View Full Version : Submission Form.
experience66
11-29-2006, 09:40 PM
Can anyone write me a simple form that allows users to submit their email then click submit which would automatically send it to my email address.
its for my website and newsletter. this would be greatly appreciated.
or even point me in the direction of one.
thanks.
thetestingsite
11-29-2006, 11:13 PM
well there are plenty of form mail scripts out there, and a ton of them are free. It is not done using plain HTML or Javascript for that matter, but a server side scripting language. Also, there are a few free hosted ones that I have seen for this if your server does not support certain server side languages. Just do a google search for a free form mailer, or look at hotscripts.com (http://www.hotscripts.com). Also, if your server supports PHP, have a look at a few of the threads in this forum. They have a few that talk about form mail scripts. Hope this helps.
Yo experience66!
I was looking to learn how to do this a whille back and found all the answers when I contacted my hosting provider.
If they have good support you may be suprised how much you can find searching FAQ. I found what I was looking for under the heading, Sending Email from a Website.
Check out the form I made at www.dc5b.com/portfolio/contact.asp
It uses ASP and JMail but not all servers will support this.
good luck
dog
chechu
11-30-2006, 04:22 PM
Look in this thread: http://www.dynamicdrive.com/forums/showthread.php?t=15010
In the middle you will find both codes for the contact.html and contact.php page. Just copy, past and adapt.
Also look in this forum under PHP, and you will find lots of discussions about it.
Look in this thread: http://www.dynamicdrive.com/forums/showthread.php?t=15010
In the middle you will find both codes for the contact.html and contact.php page. Just copy, past and adapt.
Chechu,
I just took a look at the thread you pointed to above.
It's perfect for answering all of the initial questions that I logged on to ask!!
I wouldn't have come across it if I hadn't taken a look through the HTML Forum first to see if there was anything I could help with.
It just goes to show what goes around comes around.
Thanks a lot.
chechu
11-30-2006, 09:10 PM
Before asking stuff, take a look in the forum and read threads thorougly. Some of the subjects may not be what you need, but in the thread you might find something usefull. Every day I pass half an hour looking at new comments and threads. There's always something you can learn.
And sometimes you will experience that great sensation that you can actually help someone in solving his problem, allthough you're a newbie yourself.
Indeed; what goes around comes around ...
GhettoT
11-30-2006, 10:19 PM
Yo experience66!
I was looking to learn how to do this a whille back and found all the answers when I contacted my hosting provider.
If they have good support you may be suprised how much you can find searching FAQ. I found what I was looking for under the heading, Sending Email from a Website.
Check out the form I made at www.dc5b.com/portfolio/contact.asp
It uses ASP and JMail but not all servers will support this.
good luck
dog
How did you create that form? Is their any source code that i could use?
How did you create that form? Is their any source code that i could use?
The form is an HTML form styled with CSS.
The backend is done with ASP and JMail.
You're welcome to any code that you like.
Let me know what you're interested in and I'll put it on display here.
GhettoT
12-01-2006, 01:35 AM
I guess I am just really interested (not to sound like a retard tha can't do anything) in the whole thing. I probbably will only end up using a fraction of if but, your form is probably the cleanest i have ever seen... Good job!
I guess I am just really interested (not to sound like a retard tha can't do anything) in the whole thing. I probbably will only end up using a fraction of if but, your form is probably the cleanest i have ever seen... Good job!
GT,
So I take it you're interested in the styling of the form more than the back end.
I'll get a simplified version of the HTML and CSS files and post the code for you.
Hold tight.
Here's the HTML:
<div id="contactForm">
<div id="formHolder">
<input class="input" name="name" type="text" />
<div class="inputName">Name:</div>
<input class="input" name="email" type="text" />
<div class="inputName">Email:</div>
<input class="input" name="phone" type="text" />
<div class="inputName">Phone:</div>
<textarea class="input2" name="message"></textarea>
<div class="inputName">Message:</div>
<input class="input3" name="news" type="checkbox" />
<div class="inputName2">
Check the box to receive updates.</div>
<input name="send" type="submit" class="send" value="OK" />
</div>
<% if Request.QueryString("sent") = "ok" then %>
<div id="successNote">
Message sent successfully.
</div>
<% end if %>
<% if Request.QueryString("sent") = "fail" then %>
<div id="successNote">
Error sending message: <% Response.Write(Request("error")) %>.
</div>
<% end if %>
</div>
Note: it's actually an ASP file, hence all the name attributes and success notes.
Here comes the CSS:
body {
font: normal 12px/18px Arial, Helvetica, sans-serif;
color: #999;
}
#contactForm {
position: relative;
width: 235;
margin: 18 0 28 15px;
}
#formHolder {
width: 235;
background: white;
border: #ccc solid 1px;
margin: 0 0 15 0;
font-size: 11;
padding: 5px 0 28px 0;
}
input, textarea {
color: #999;
font-size: 11;
font-family: "Courier New", Courier, mono;
}
.input, .input2, .send {
float: right;
margin-right: 5px;
background: white;
border: #999 solid 1px;
border-width: 0 0 1px 0;
}
.input, .input2 {
width: 160px;
}
.inputName, .input, .input3 {
height: 16;
}
.inputName{
height: 18;
margin: 0 0 5px 5px;
}
.inputName, .inputName2 {
color: #666;
}
.input2 {
height: 58;
margin-bottom: 20;
overflow-y: auto;
}
.input3 {
margin: 0 0 0 8;
clear: right;
float: left;
}
.inputName2 {
clear: right;
display: block;
text-align: right;
margin: 4px 5px 4px 0;
font-size: 11;
}
.send {
margin-top: 4;
text-align: center;
}
#successNote {
width: 235;
background: white;
border: #ccc dotted 1px;
margin: 5 0;
font-size: 12;
padding: 5px;
text-align: center;
color: #99c;
}
I think the main things to note are:
I've positioned the inputs alongside the "inputName"s by placing the inputs first in the HTML and floating them to the right. That way they stay on the same horizontal as their titles. This make the HTML a little backward but I couldn't think of another way of doing it. I've used a lot of CSS.
I hope this helps.;)
GhettoT
12-02-2006, 01:06 AM
Thaks for that! But where would i thrown in the line of code that tells it to send the message/comment to a specific e-mail address?
-GT
Thaks for that! But where would i thrown in the line of code that tells it to send the message/comment to a specific e-mail address?
Ok, so the HTML that I posted above is from inside this form:
<form method=post action="SendMail.asp" name="frmMail">
...
</form>
Note: you'll have to call your page 'contact.asp' and not 'contact.html' or the ASP response (e.g. the Success Note) won't function correctly, and who knows what else?
The form is calling another ASP file, "SendMail.asp" which is where your 'line of code' gets thrown in.
SendMail.asp:
<html>
<head>
<title>w3 JMail rocks</title>
</head>
<body>
<%
'Initialise objects and variables
Dim JMail, intComp, strReferer, strServer, strClientIP, strServerIP, blnSpam
Set JMail = Server.CreateObject("JMail.Message") 'Check if this page is being called from a another page on the server
strReferer = request.servervariables("HTTP_REFERER")
strServer = Replace(request.servervariables("SERVER_NAME"), "www.", "")
strClientIP = request.servervariables("REMOTE_ADDR")
strServerIP = request.servervariables("LOCAL_ADDR")
intComp = inStr(strReferer, strServer)
If intComp > 0 Then
blnSpam = False
Else
' Spam Attempt Block
blnSpam = True
End If
' This is my local SMTP server
'JMail.ServerAddress = "smtp."&strServer&":25"
JMail.Logging = true
JMail.silent = true
' This is me....
JMail.From = "noreply@"&strServer
JMail.Subject = "E-mail from site:"&" Sent @ "&now()
' Get the recipients mailbox from a form (note the lack of a equal sign).
JMail.AddRecipient "probably@youremail.com"
JMail.Body = "Name: "& Request.Form("name") & vbcrlf & "Email: " & Request.Form("email") & vbcrlf & "Phone: " & Request.Form("phone") & vbcrlf & "Message: " & Request.Form("message") & vbcrlf & "News: " & Request.Form("news")
JMail.Priority = 3
JMail.AddHeader "Originating-IP", strClientIP
'send mail
If NOT JMail.Send("smtp."&strServer&":25") Then
Response.Redirect("contact.asp?sent=fail&error=" & JMail.Log)
Else
Response.Redirect("contact.asp?sent=ok")
End If
%>
</body>
</html>
This is JMail. My hosting providers told me this would be good to use but I don't know if all servers will necessarily support it.
There are plenty of other methods for sending forms that you can find being discussed in the HTML and PHP forums. Most likely in the ASP forum too.
I hope this helps. :cool:
dog
hey Dog! thats a cool one. seems simple too! I am also stuck up as to how to use enquiry form on my website which the user can fill in and it comes in my mailbox!! can u help me with the code used in ur website. That wud be of great help buddy. I have been banging my head for a long time now!!
My host server supports ASp not PHP. I think u have used asp only right?
thanks in advance man! I am just a designer and having a tough time with coding. guess have to learn it soon
mburt
02-17-2007, 12:07 PM
Yes, that is asp, so you should be able to go ahead and use it. But for us to help you implement it on your site we'll need your site link, or code.
hey Dog! thats a cool one. seems simple too! I am also stuck up as to how to use enquiry form on my website which the user can fill in and it comes in my mailbox!! can u help me with the code used in ur website. That wud be of great help buddy. I have been banging my head for a long time now!!
My host server supports ASp not PHP. I think u have used asp only right?
thanks in advance man! I am just a designer and having a tough time with coding. guess have to learn it soon
Yes, that is asp, so you should be able to go ahead and use it. But for us to help you implement it on your site we'll need your site link, or code.
form_ac.asp file. Though I am confused what to put here..NewMailObj.From = "???????"
<%@ Language="VBscript" %>
<% Option Explicit %>
<html>
<head>
<title>Thank you for the enquiry.</title>
</head>
<body>
<%
'declare the variables that will receive the values
'receive the values sent from the form and assign them to variables
'note that request.form("name") will receive the value entered into the textfield
'called name, and so with email and message
Dim name, organisation, address, email, commodities, quantities, destination, timeframe, payment, comments, NewMailObj
name=request.form("txtName")
organisation=request.form("txtOrg")
address=request.form("textAdd")
email=request.form("txtEmail")
commodities=request.form("textcommodities")
quantities=request.form("textquantity")
destination=request.form("textdestination")
timeframe=request.form("texttimeframe")
payment=request.form("textpayment")
comments=request.form("txtcomments")
'create the mail object and send the details
Set NewMailObj=Server.CreateObject("CDONTS.NewMail")
NewMailObj.From = "???????"
NewMailObj.To = "sales@xyz.com"
NewMailObj.Subject = "Enquiry from the website"
NewMailObj.Body = "the name entered is " & name & _
"<br>the organisation is " & organisation & _
"<br>the address is " & address & _
"<br>the email is " & email & _
"<br>the commodities are" & commodities & _
"<br>the quantities are " & quantities & _
"<br>the destination is " & destination & _
"<br>the time required is " & time & _
"<br>the payment mode is " & payment & _
"<br>the comments are " & comments & _
'you need to add the following lines FOR the mail to be sent in HTML format
NewMailObj.BodyFormat = 0
NewMailObj.MailFormat = 0
NewMailObj.Send
'Close the email object and free up resources
Set NewMailObj = nothing
Response.write "Thank you for the enquiry."
%>
</body>
</html>
<%@ Language="VBscript" %>
<% Option Explicit %>
<html>
<head>
<title>Thank you for the enquiry.</title>
</head>
<body>
<%
'declare the variables that will receive the values
'receive the values sent from the form and assign them to variables
'note that request.form("name") will receive the value entered into the textfield
'called name, and so with email and message
Dim name, organisation, address, email, commodities, quantities, destination, timeframe, payment, comments, NewMailObj
name=request.form("txtName")
organisation=request.form("txtOrg")
address=request.form("textAdd")
email=request.form("txtEmail")
commodities=request.form("textcommodities")
quantities=request.form("textquantity")
destination=request.form("textdestination")
timeframe=request.form("texttimeframe")
payment=request.form("textpayment")
comments=request.form("txtcomments")
'create the mail object and send the details
Set NewMailObj=Server.CreateObject("CDONTS.NewMail")
NewMailObj.From = "???????"
NewMailObj.To = "sales@xyz.com"
NewMailObj.Subject = "Enquiry from the website"
NewMailObj.Body = "the name entered is " & name & _
"<br>the organisation is " & organisation & _
"<br>the address is " & address & _
"<br>the email is " & email & _
"<br>the commodities are" & commodities & _
"<br>the quantities are " & quantities & _
"<br>the destination is " & destination & _
"<br>the time required is " & time & _
"<br>the payment mode is " & payment & _
"<br>the comments are " & comments & _
'you need to add the following lines FOR the mail to be sent in HTML format
NewMailObj.BodyFormat = 0
NewMailObj.MailFormat = 0
NewMailObj.Send
'Close the email object and free up resources
Set NewMailObj = nothing
Response.write "Thank you for the enquiry."
%>
</body>
</html>
enquiry.htm file has code as:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="style.css" rel="stylesheet" type="text/css">>
</head>
<body>
<table width="549" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"><img src="images/trans_bar.gif" width="1" height="30"></td>
</tr>
<tr>
<td width="5" align="left" valign="top" bgcolor="#FFFFFF"><img src="images/trans_bar.gif" width="5" height="1"></td>
</tr>
<tr>
<td align="left" valign="top"><table width="545" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" rowspan="4"></td>
<td height="16" align="right" valign="top"><img src="images/enquiry_txt.gif" width="80" height="16" align="top"></td>
<td width="10" rowspan="4"><img src="images/trans_bar.gif" width="10" height="1"></td>
</tr>
<tr>
<td width="1" valign="top" bgcolor="#5C97D1"><img src="images/trans_bar.gif" width="1" height="1"></td>
</tr>
<tr>
<td height="7" align="left" valign="top"><img src="images/blue_dot.gif" width="5" height="7"></td>
</tr>
<tr>
<td valign="top"><div align="justify">
<p class="m_text"><br>
ardstaysklfjsdl;gbkdf;lbnfxcbnxc,bnxdfkb>
<p class="m_text">Please email us with your requirements mentioning the following details:</p>
<table width="100%" border="0" cellspacing="2" cellpadding="5">
<tr>
<td valign="top"><SCRIPT>
String.prototype.trim = function()
{
// skip leading and trailing whitespace
// and return everything in between
return this.replace(/(^\s *)|(\s*$)/g,"")
}
function validateEmail(obj)
{
//Validates email
var tempEmail = obj.value.trim();
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(tempEmail))
{
return true;
}
else
{
alert("Incorrect email address");
obj.focus();
return false;
}
}
function validateForm()
{
//Email validation
if(document.mobicon.txtEmail.value.trim() == '')
{
alert("Email Id is required");
document.mobicon.txtEmail.focus();
return false;
}
if(!validateEmail(document.mobicon.txtEmail))
{
return false;
}
//Name validation
if(document.mobicon.txtName.value.trim() == '')
{
alert("Name is required");
document.mobicon.txtName.focus();
return false;
}
return true;
}
</SCRIPT>
<FORM name="mobicon" onsubmit="return validateForm();" action="form_ac.asp" target="centerframe" method="post">
<p> <span class="m2_text">YourName*: </span>
<input name="txtName" type="text" id="txtName2" size="30" maxlength="100">
</p>
<p> <span class="m2_text">Organisation:</span>
<input name="txtOrg" type="text" id="txtOrg2" size="30" maxlength="100">
</p>
<p><span class="m2_text">Address:</span>
<input name="textAdd" type="text" id="textAdd" value="" size="30">
</p>
<p><span class="m2_text">email ID*:</span>
<input name="txtEmail" type="text" id="txtEmail" size="30" maxlength="100">
</p>
<p><span class="m2_text">Commodities:</span>
<textarea name="textcommodities" cols="22" rows="4" id="textcommodities"></textarea>
</p>
<p><span class="m2_text">Quantity: </span>
<input name="textquantity" type="text" id="textquantity" size="30" maxlength="150">
</p>
<p><span class="m2_text">Destination:</span>
<input name="textdestination" type="text" id="textdestination" size="30" maxlength="100">
</p>
<p><span class="m2_text">Timeframe:</span>
<input name="texttimeframe" type="text" id="texttimeframe" size="30" maxlength="100">
</p>
<p><span class="m2_text">Payment Methood:
<input name="textpayment" type="text" id="textpayment" size="30" maxlength="100">
<br>
(DLC / SBLC / BG / <br>
TT/ DAP) </span> </p>
<p><span class="m2_text">Comments: </span>
<textarea name="txtcomments" cols="23" rows="4" id="txtcomments"></textarea>
</p>
<p>
<INPUT name="email" type=submit id="email" value="E-mail">
</p>
</form></td>
</tr>
</table>
<p></p>
</div></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
ljplemons
03-12-2007, 04:42 PM
I have been reading your posts on creation of forms and am having a problem 'grasping' the 'how to'.
I have created a form:
http://www.winterfestmd.com/registrationform2.html
But I cannot get the 'submit' button to work right. I am using Front Page (yes I know pls don't bark at me!) to create it and publish it as this was suggested from my provider, something to do with server extensions or something. I have read the other posts regarding necessary scripting but don't really understand it. I design not code as well so here lies my struggle. I have copied some of the other scripting you guys have posted here into another html editor I use and can't seem to understand the results. I just want the info entered to be sent via email to me. I also have googled free form mailers but all I get is a company that says it is free but its not...:confused: Help?
thetestingsite
03-12-2007, 08:52 PM
In the code of the page you posted above, you do not have an opening form tag. This must be added for the form to function. An example of this would be as follows:
<form action="test.php" method="POST">
Your name: <input type="text" name="your_name">
<input type="submit" value="Submit this form">
</form>
Notice the part in red in the above code, and how it is placed before any other form elements.
Hope this helps.
ljplemons
03-15-2007, 04:35 PM
I wasn't sure actually if you were talking to me or the person who posted above me?
just in case I have since added this line: <form action="gdform.asp" method="post">
received from my provider so things are getting better. I made so many changes after talking to them then talking to Microsoft I had to start over: www.winterfestmd.com/form1.htm
this form will email me results, however it will not save info to a file...
thetestingsite
03-16-2007, 12:03 AM
Is it in ASP or in PHP? Either way, post the code and we could see if we could modify it to work for your needs.
Hope this helps.
kwest
03-16-2007, 05:28 AM
Can anyone tell me what is wrong with my coding. I can't get the form to send to my email. Thanks for all your info. KW
<form method="post" action="http://www.warf-enterprises.com/formmail.php" name="Free Money">
<input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_USER">
<input type="hidden" name="recipient" value="info@warf-enterprises.com">
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td><h3 style="border-bottom:1px solid black;">Blank Form</h3></td>
</tr>
<tr>
<td>
<label for="name" style="float:left;width:140px;">Your Name</label><input type="text" name="name" id="name" value="" maxlength="" style="width:200px;"><div style="clear:left;height:20px;"> </div>
<label for="address" style="float:left;width:140px;">Your address</label><textarea name="address" id="address" style="width:200px;height:50px;"></textarea><div style="clear:left;height:20px;"> </div>
<label for="phone" style="float:left;width:140px;">Your phone number</label><input type="text" name="phone" id="phone" value="" maxlength="" style="width:200px;"><div style="clear:left;height:20px;"> </div>
<label for="email" style="float:left;width:140px;">Your email address</label><input type="text" name="email" id="email" value="" maxlength="" style="width:200px;"><div style="clear:left;height:20px;"> </div>
<label for="Fname" style="float:left;width:140px;">Your FRIEND'S name</label><input type="text" name="Fname" id="Fname" value="" maxlength="" style="width:200px;"><div style="clear:left;height:20px;"> </div>
<label for="faddress" style="float:left;width:140px;">Your FRIEND'S address</label><textarea name="faddress" id="faddress" style="width:200px;height:50px;"></textarea><div style="clear:left;height:20px;"> </div>
<label for="Fphone" style="float:left;width:140px;">Your FRIEND's phone number</label><input type="text" name="Fphone" id="Fphone" value="" maxlength="" style="width:200px;"><div style="clear:left;height:20px;"> </div>
<label for="Femail" style="float:left;width:140px;">Your FRIEND's email address</label><input type="text" name="Femail" id="Femail" value="" maxlength="" style="width:200px;"><div style="clear:left;height:20px;"> </div>
</td>
<tr>
<td align="right">
<input type="submit" value=" Submit "> </td>
</tr>
</table>
</form>
thetestingsite
03-16-2007, 03:42 PM
You may want to check the code in formmail.php. Also, do you get an error message or is it just not sending the emails? If you get an error message, post it so that we can narrow down the problem faster.
Hope this helps.
kwest
03-16-2007, 04:01 PM
Thank you so much for your help. Here is where it takes me when I click on send:
The webpage cannot be found
HTTP 404
Most likely causes:
There might be a typing error in the address.
If you clicked on a link, it may be out of date.
What you can try:
Retype the address.
Go back to the previous page.
Go to www.warf-enterprises.com and look for the information you want
The formmail.php has alot of info in it and I'm not sure if I've put in my info in the right place. It is very confusing to me. I can copy and paste it, but I warn you it is alot. Thanks again. KW
thetestingsite
03-16-2007, 04:05 PM
If you are getting the HTTP 404 error, then you are either not pointing to formmail.php correctly in your form action, or it is not uploaded to the server. Instead of using an absolute path (http://blah.com/script.php), use a relative path in the action attribute of the form, like so:
<form action="formmail.php" method="POST">
Instead of:
<form action="http://www.warf-enterprises.com/formmail.php" method="POST">
Hope this helps.
kwest
03-17-2007, 02:44 AM
Thanks again. I tried that but it still did not work. There's got to be something in the formmail.php that I'm missing but I don't have a clue what it is. I wrote to my host but they have not answered. They may not know either. Thanks again for your help. KW
thetestingsite
03-17-2007, 03:34 AM
Well, are you still getting the HTTP 404 error, or are you getting something else? Like I said, if it is the 404 error, then it is nothing to do with the script itself (other than the fact that it is either not named correctly, not on the server at all, or the form not pointing to the file correctly). If you would like, post the contents of formmail.php (after stripping any personal information) and we can see if there is something wrong with that.
Hope this helps.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.