Author |
Topic  |
JJenson
Advanced Member
    
USA
2121 Posts |
Posted - 18 February 2007 : 22:55:19
|
I created a email form in html and I am using asp to send it to me. this is the code I have I got it from someone else I am unsure why they put a couple lines in it this is the full code and I will post the part in question after:
The part I am questioning about and the code I think I can exclude it this: (The part in red is the part I am questioning)
I don't think I need this but I am unsure. Thanks All
|
Edited by - JJenson on 18 February 2007 22:56:46 |
|
JJenson
Advanced Member
    
USA
2121 Posts |
Posted - 19 February 2007 : 11:27:57
|
Ok well commmented it out and now it says it sends but it does not send. I am guessing this is because all my fields start with db_ so now I need to take them all out? Anyways any ideas on possibly a different way to do this or word it would be great thanks all. Mainly wondering if someone has a script to send form information they wouldn't mind sharing I would be greatful. Thanks All |
 |
|
HuwR
Forum Admin
    
United Kingdom
20595 Posts |
Posted - 19 February 2007 : 11:37:57
|
first question, Is CDOSYS actually set up on your server ? one of the biggest causes of non-sending mail is that CDOSYS is not actually configured on the server. It is installed and usable by default, but does not actually contain any server information which would allow it t sent emails. |
 |
|
JJenson
Advanced Member
    
USA
2121 Posts |
Posted - 19 February 2007 : 12:05:22
|
Yes this form will actually send if I prefice the name of the field with a db_ example:
like my name field if I make it db_name it will work but if I take out the db and change it to fname it does not work. I hope this makes sense?
I am trying to change this so I can use a javascript validator I found and I have to adapt one of the code figured this one would be easier. |
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 19 February 2007 : 12:07:56
|
In that case, try changing the for loop to:
For each x in request.form
results = results&x&": "&request.form(x)&vbcrlf
next The reason it's checking for "db_" is so that only those fields that pertain to the quix results are included in the body of the e-mail. If your form does not have any fields whose names start with db_ then nothing gets placed in the body of the mail. Without the check, though, all fields will appear in the body so the best way to go about it really, is to retrieve each field individually and build the body of your mail exactly as you want it.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
Edited by - Shaggy on 19 February 2007 12:10:51 |
 |
|
JJenson
Advanced Member
    
USA
2121 Posts |
Posted - 19 February 2007 : 12:19:28
|
Thanks will give it a go a little later. Thanks guys so basically shaggy you say build my form and then write the code up for the form I created? Just want to make sure I am clear on that.
Thanks All |
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 19 February 2007 : 12:27:02
|
Pretty much; you'll find it much easier to achieve exactly what you want and to change it further down the road, if need be.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
JJenson
Advanced Member
    
USA
2121 Posts |
Posted - 19 February 2007 : 12:29:32
|
Well I have never written anything from scratch so I will have a go at it. Does anyone know where I could receive a tutorial or some little guidance online so I can attempt this? |
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 19 February 2007 : 12:45:50
|
Most of it, as far as sending out the e-mail goes, is already in the script you posted above. All you need to do is retrieve each of your form fields individually and append them to the "results" string which is used as the body of the e-mail that gets sent out. To retrieve the value of a field in a form, use request.form("fieldname") where fieldname is the name of the field in your form (e.g., db_name or fname in the example you posted above).
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
JJenson
Advanced Member
    
USA
2121 Posts |
Posted - 19 February 2007 : 13:04:26
|
ok so would I need to take out the code in question above and replace that with the request.form("fieldname") ? I think I got how it works cause that code would pretty much become useless I think?
Thanks Shaggy |
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 19 February 2007 : 13:06:31
|
You're welcome Have a play around with it and see how you get on.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
JJenson
Advanced Member
    
USA
2121 Posts |
Posted - 19 February 2007 : 18:00:18
|
ok Shaggy i got my validation code working and everything and the email sends but the only thing in the body is
"Contact Results:"
It is not picking up my form for some reason? This is my updated code and yes I know it is not changed alot but I am guessing I put it in the wrong place any help would be greatly appreciated.
Thanks All
|
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 20 February 2007 : 05:59:55
|
To place the value of each field in your results variable, you'll need something like:
results=results&"Fname: "&request.form("fname")&vbnewline results=results&"Oname: "&request.form("oname")&vbnewline . . .
Where you currently have just:
request.form("fname") request.form("oname") . . .
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
JJenson
Advanced Member
    
USA
2121 Posts |
Posted - 20 February 2007 : 09:34:45
|
Oh ok I figured it was something like that. I could not find anything over a w3 schools on this or what I needed to call out for. Now this will work for check boxes and radio buttons as well right?
Thanks again shaggy taking baby steps and just starting to go outside the forum and learn so I feel like I know nothing again. the help is much appreciated.  |
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 20 February 2007 : 09:57:07
|
Yes, you retrieve the values of radio and checkbox inputs in the same way. Note, though, that if a checkbox is not checked of none of the radio buttons in a group is checked, it will have no value.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
JJenson
Advanced Member
    
USA
2121 Posts |
Posted - 20 February 2007 : 10:13:33
|
Yeah thanks shaggy I will make sure to enter that into my java validation code to make sure something is entered.
As always thanks for the help Shaggy someday I might actually get good at this  |
 |
|
Topic  |
|