Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
What Wrong with this??
Old 01-02-2005, 08:33 PM What Wrong with this??
Extreme Talker

Posts: 176
Trades: 0
Okay i found this script somewhere to do a form and i put it in my website and everytime you load the page it says "thank you for using our email forms" or something like that before you even do anything and after that it wont work..... here is the script




Steps to install the E-mail form and form handler:
Copy all the code into a text editor, such as Notepad,
in order to transform the HTML entities into HTML code.
If you paste it directly into a WYSIWIG editor's HTML
view, you will get &lt; instead of < and so on.
You can search and replace, but it takes longer.

Then:
1. Copy the JavaScript code into the HEAD of your HTML document.
2. Copy the VBScript code into the HEAD or BODY of your HTML document.
3. Copy the Form code into the BODY of your HTML document.

STEP ONE: COPY THIS JAVASCRIPT INTO THE HEAD OF HTML DOCUMENT
<script language="JavaScript">
function validator(theForm) {
if (theForm.user_email.value == "")
{
alert("You must enter an e-mail address!");
theForm.user_email.focus();
return (false);
}
}
</script>

STEP TWO: COPY THIS VBSCRIPT INTO THE HEAD OR BODY OF HTML DOCUMENT

<!-- Beginning of ASP Form-Handler Script -->
<%
'Declare variables for the e-mail script
dim strAddr
dim replyTo
dim strSubject
dim strText

'Next, declare itsReady variable so we can trigger e-mail function
'only if user has entered an e-mail address. A real form would
'have a stringent error checking routine
dim itsReady
itsReady = ""
'Get input from the form and assign it to script variables
strAddr = Trim(Request.form("user_email"))
if strAddr <> "" then
replyTo = cstr(strAddr)
end if

strSubject = Request.form("user_subject")
strName = Request.form("user_name")
strMsg = Request.form("user_text")
strText = "E-mail from: " & strName & vbCrLf & "Concerning: " & strMsg

'Note: use vbCrLf (as above) to add line breaks in e-mail message
'Now trigger e-mail function if submitted with a non-blank user_email

if replyTo <> "" then itsReady = send_email()

'The send_email function formats and sends the e-mail

function send_email()
'Create an object or container for your mail
Dim objMail
Set objMail = Server.CreateObject("CDO.Message")
'Format the e-mail using fields from your HTML form
objMail.To = "you@somewhere.com"
objMail.From = "visitor_form@somewhere.com"
'The From address is a fake address to alert you to
'the origin of the email. You will not reply to it.
objMail.ReplyTo = replyTo
'replyTo is the user_email address from the form
objMail.Subject = strSubject
objMail.TextBody = strText
objMail.Send 'comment out to test script without sending mail
'Release system resources
Set objMail = Nothing
'Book example includes following line; replaced by a Javascript alert box
'Response.Write "<h3>Thank you for using e-mail!</h3>"
if err.number > 0 then
response.write "Errors were encountered in sending your e-mail message. "&_
"Please try again, or contact the <a href='mailto:you@somewhere.com'>webmaster</a>"
else
%>
<script language="JavaScript">
<!--
alert("Your e-mail has been sent!\nThank you for using our e-mail form!");
//-->
</script>
<%
end if
end function
%>
<!-- End of ASP Form-Handler Script -->

STEP 3: COPY THE FORM CODE INTO THE BODY OF HTML DOCUMENT
<!-- Beginning of form -->
<!-- Important: If you change the filename, you must change the form action to match. -->
<form method="post" action="mailplay.asp" onSubmit="return validator(this)">
<table border="0"><tr><td align="right">Name: </td><td>
<input type="text" name="user_name" size="20"></td></tr>
<tr><td align="right">E-mail: </td><td>
<input type="text" name="user_email" size="20"></td></tr>
<tr><td align="right">Subject: </td><td>
<input type="text" name="user_subject" size="20"></td></tr>
<tr><td align="right">Question: </td><td><textarea cols="40" wrap="virtual"
rows="3" name="user_text"></textarea></td></tr>
<tr><td>&nbsp;</td><td height="40"><input type="submit" value="Submit">&nbsp;
<input type="reset" value="Clear"></td></tr>
</table>
</form>
wmtalk.tk is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-02-2005, 09:13 PM
hostyorkshire's Avatar
Super Talker

Posts: 129
Location: Barnsley, South Yorks
Trades: 0
Instead of picking though a script that looks to be a half baked forum, why don't you go and install yourself PHPBB or something like this.

I think it would be much more stable and you have a tremendous amount of options an control over it plus a support forum so you could ask questions if something goes wrong or you need to add more functionallity.

Most web hosts offer forums that you can easily install without having to hack away at a configuration code. Host Yorkshire makes it simple and offers fantastico which as over 40+ script including forums which can be installed within seconds.

If your host dosen't support this but does support mySQL you could always install it yourself or get someone to help you!

Any more questions about forums just shout - I love em!

Review mine here - http://www.webmaster-talk.com/showthread.php?t=20869


Andrew
www.hostyorkshire.com
hostyorkshire is offline
Reply With Quote
View Public Profile Visit hostyorkshire's homepage!
 
Old 01-04-2005, 01:10 AM
Extreme Talker

Posts: 176
Trades: 0
yea to problems with that, im a newbie and i have no idea what you just said and 2, i was looking for more of a quick support option that was really fast all you have to do is type in your question and i emails it to me. I have forms to go and i tried using php and whatnot but that didnt work out either.
wmtalk.tk is offline
Reply With Quote
View Public Profile
 
Old 01-04-2005, 08:28 AM
ACJavascript's Avatar
Humble Mod

Posts: 548
Location: CT, USA
Trades: 0
Try this:



STEP TWO: COPY THIS VBSCRIPT INTO THE HEAD OR BODY OF HTML DOCUMENT

<!-- Beginning of ASP Form-Handler Script -->
<%
'Declare variables for the e-mail script
dim strAddr
dim replyTo
dim strSubject
dim strText
dim check

'Check to see if the form has been submited.
if Trim(Request.form("pageid"))=="1" THEN

'Next, declare itsReady variable so we can trigger e-mail function
'only if user has entered an e-mail address. A real form would
'have a stringent error checking routine
dim itsReady
itsReady = ""
'Get input from the form and assign it to script variables
strAddr = Trim(Request.form("user_email"))
if strAddr <> "" then
replyTo = cstr(strAddr)
end if

strSubject = Request.form("user_subject")
strName = Request.form("user_name")
strMsg = Request.form("user_text")
strText = "E-mail from: " & strName & vbCrLf & "Concerning: " & strMsg

'Note: use vbCrLf (as above) to add line breaks in e-mail message
'Now trigger e-mail function if submitted with a non-blank user_email

if replyTo <> "" then itsReady = send_email()
END IF

'The send_email function formats and sends the e-mail

function send_email()
'Create an object or container for your mail
Dim objMail
Set objMail = Server.CreateObject("CDO.Message")
'Format the e-mail using fields from your HTML form
objMail.To = "you@somewhere.com"
objMail.From = "visitor_form@somewhere.com"
'The From address is a fake address to alert you to
'the origin of the email. You will not reply to it.
objMail.ReplyTo = replyTo
'replyTo is the user_email address from the form
objMail.Subject = strSubject
objMail.TextBody = strText
objMail.Send 'comment out to test script without sending mail
'Release system resources
Set objMail = Nothing
'Book example includes following line; replaced by a Javascript alert box
'Response.Write "<h3>Thank you for using e-mail!</h3>"
if err.number > 0 then
response.write "Errors were encountered in sending your e-mail message. "&_
"Please try again, or contact the <a href='mailto:you@somewhere.com'>webmaster</a>"
else
%>
<script language="JavaScript">
<!--
alert("Your e-mail has been sent!\nThank you for using our e-mail form!");
//-->
</script>
<%
end if
end function
%>
<!-- End of ASP Form-Handler Script -->

STEP 3: COPY THE FORM CODE INTO THE BODY OF HTML DOCUMENT
<!-- Beginning of form -->
<!-- Important: If you change the filename, you must change the form action to match. -->
<script language="JavaScript">
function validatetheForm) {
if (document.theForm.user_email.value == "")
{
alert("You must enter an e-mail address!");
document.theForm.user_email.focus();
return (false);
}else{
document.theForm.submit();
}
}

</script>
<form method="post" action="mailplay.asp" name="theForm">
<input type="hidden" name="pageid" value="1">
<table border="0"><tr><td align="right">Name: </td><td>
<input type="text" name="user_name" size="20"></td></tr>
<tr><td align="right">E-mail: </td><td>
<input type="text" name="user_email" size="20"></td></tr>
<tr><td align="right">Subject: </td><td>
<input type="text" name="user_subject" size="20"></td></tr>
<tr><td align="right">Question: </td><td><textarea cols="40" wrap="virtual"
rows="3" name="user_text"></textarea></td></tr>
<tr><td>&nbsp;</td><td height="40"><input type="button" value="Submit" onclick="validate()">&nbsp;
<input type="reset" value="Clear"></td></tr>
</table>
</form>



You were supposed to have the asp script in a seperated file from the html. I think thats were the problem was. I added some code to allow this so try it and see what happends
__________________

Please login or register to view this content. Registration is FREE
- 100 Satisfied Customers - Custom Programming and Web Development

Last edited by ACJavascript; 01-04-2005 at 08:31 AM..
ACJavascript is offline
Reply With Quote
View Public Profile Visit ACJavascript's homepage!
 
Old 01-05-2005, 07:38 PM
Extreme Talker

Posts: 176
Trades: 0
yea it still doesnt work am i supposed to have a seperate file??

my site is www50.brinkster.com/wmtalk/index.html

Last edited by wmtalk.tk; 01-05-2005 at 07:53 PM..
wmtalk.tk is offline
Reply With Quote
View Public Profile
 
Old 01-05-2005, 07:58 PM
ACJavascript's Avatar
Humble Mod

Posts: 548
Location: CT, USA
Trades: 0
Try this:

THis goes into its own file lets call it "test.asp"
PHP Code:
<%
'Declare variables for the e-mail script
dim strAddr
dim replyTo
dim strSubject
dim strText

'
Next, declare itsReady variable so we can trigger e-mail function
'only if user has entered an e-mail address. A real form would 
'
have a stringent error checking routine
dim itsReady
itsReady 
""
'Get input from the form and assign it to script variables
strAddr = Trim(Request.form("user_email"))
if strAddr <> "" then
replyTo = cstr(strAddr)
end if

strSubject = Request.form("user_subject")
strName = Request.form("user_name")
strMsg = Request.form("user_text")
strText = "E-mail from: " & strName & vbCrLf & "Concerning: " & strMsg

'
Note: use vbCrLf (as aboveto add line breaks in e-mail message
'Now trigger e-mail function if submitted with a non-blank user_email

if replyTo <> "" then itsReady = send_email()

'
The send_email function formats and sends the e-mail

function send_email()
'Create an object or container for your mail
Dim objMail
Set objMail = Server.CreateObject("CDO.Message")
'
Format the e-mail using fields from your HTML form
objMail
.To "you@somewhere.com"
objMail.From "visitor_form@somewhere.com" 
'The From address is a fake address to alert you to
'
the origin of the emailYou will not reply to it
objMail.ReplyTo replyTo
'replyTo is the user_email address from the form
objMail.Subject = strSubject
objMail.TextBody = strText
objMail.Send '
comment out to test script without sending mail
'Release system resources
Set objMail = Nothing
'
Book example includes following linereplaced by a Javascript alert box
'Response.Write "<h3>Thank you for using e-mail!</h3>" 
if err.number > 0 then
response.write "Errors were encountered in sending your e-mail message. "&_
"Please try again, or contact the <a href='
mailto:you@somewhere.com'>webmaster</a>"
else
%>
<script language="JavaScript">
<!--
alert("Your e-mail has been sent!\nThank you for using our e-mail form!");
//-->
</script>
<%
end if
end function
%> 
This goes onto a .html page:
PHP Code:
<script language="JavaScript">
function 
validator(theForm) {
if (
theForm.user_email.value == "")
{
alert("You must enter an e-mail address!");
theForm.user_email.focus();
return (
false);
}

</script>
<!-- Beginning of form -->
<!-- Important: If you change the filename, you must change the form action to match. -->
<form method="post" action="test.asp" onSubmit="return validator(this)">
<table border="0"><tr><td align="right">Name: </td><td>
<input type="text" name="user_name" size="20"></td></tr>
<tr><td align="right">E-mail: </td><td>
<input type="text" name="user_email" size="20"></td></tr>
<tr><td align="right">Subject: </td><td>
<input type="text" name="user_subject" size="20"></td></tr>
<tr><td align="right">Question: </td><td><textarea cols="40" wrap="virtual" 
rows="3" name="user_text"></textarea></td></tr>
<tr><td>&nbsp;</td><td height="40"><input type="submit" value="Submit">&nbsp; 
<input type="reset" value="Clear"></td></tr>
</table> 
</form> 
Try that see if it works.
__________________

Please login or register to view this content. Registration is FREE
- 100 Satisfied Customers - Custom Programming and Web Development
ACJavascript is offline
Reply With Quote
View Public Profile Visit ACJavascript's homepage!
 
Old 01-06-2005, 02:29 AM
Extreme Talker

Posts: 176
Trades: 0
wow thanks for your help but it still doesnt work
rrrrrrrr, im getting frustrated k heres what it says when i submit the data to the form:

Server object error 'ASP 0178 : 80070005'

Server.CreateObject Access Error

/wmtalk/test.asp, line 34

The call to Server.CreateObject failed while checking permissions. Access is denied to this object.


Here is line 34:

Set objMail = Server.CreateObject("CDO.Message")


Do i have to put a body and stuff in the test.asp??
wmtalk.tk is offline
Reply With Quote
View Public Profile
 
Old 01-14-2005, 08:47 PM
Rufo's Avatar
Extreme Talker

Posts: 173
Trades: 0
It looks like you don't have permission to use sendmail (or the Windows equivalent).
AFAIK, Brinkster stopped you using it on free ccounts because of spamming.
__________________

Please login or register to view this content. Registration is FREE
Rufo is offline
Reply With Quote
View Public Profile Visit Rufo's homepage!
 
Reply     « Reply to What Wrong with this??
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31669 seconds with 12 queries