468,554 Members | 1,388 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,554 developers. It's quick & easy.

Send Form Results to User-selected email address

Hi. How can I send form results to an email address based on what the user
selects? e.g. not to the same address all the time, and not to all
addresses, but to the one that the user selects. How can I refer to that?
Thanks for the help.

Nathaniel Maier
email/MSNmsg: nm****@columbus.rr.com
AIM: OSUKid7
Jul 20 '05 #1
13 5993
Thx, but could you show me some code? Sry I rarely hard code HTML...so if it
isn't too much of a problem could you elaborate a bit more and show some
code? Thanks.

Nathaniel Maier
email/MSNmsg: nm****@columbus.rr.com
AIM: OSUKid7

"Brian" <us*****@mangymutt.com.invalid-remove-this-part> wrote in message
news:151Ta.115959$Ph3.14990@sccrnsc04...
Nathaniel Maier wrote:
How can I send form results to an email address based on what the user
selects? e.g. not to the same address all the time, and not to all
addresses, but to the one that the user selects. How can I refer to
that?
Include a field on the report that identifies the desired recipient.
Have the form script email the results to that person.

--
Brian
follow the directions in my address to email me

Jul 20 '05 #2
"Jim Dabell" <ji********@jimdabell.com> wrote in message
news:du********************@giganews.com...

[Please don't post upside down]

Nathaniel Maier wrote:
"Brian" <us*****@mangymutt.com.invalid-remove-this-part> wrote in message news:151Ta.115959$Ph3.14990@sccrnsc04...
Nathaniel Maier wrote:
> How can I send form results to an email address based on what the user > selects? e.g. not to the same address all the time, and not to all
> addresses, but to the one that the user selects. How can I refer to

that?

Include a field on the report that identifies the desired recipient.
Have the form script email the results to that person.


Thx, but could you show me some code? Sry I rarely hard code HTML...so if it isn't too much of a problem could you elaborate a bit more and show
some code? Thanks.


You can't do it in HTML reliably. You need a server-side script. Showing
you code is futile, as it depends on what facilities you have available to
you. Read the FAQ:

<URL:http://www.htmlhelp.org/faq/html/forms.html#mailto-form>
--
Jim Dabell


So there's no way to just refer to the data field that contains the email
address? Darn...anyone know of an easier way?

Nathaniel Maier
email/MSNmsg: nm****@columbus.rr.com
AIM: OSUKid7
Jul 20 '05 #3
Nathaniel Maier <news:MJ***************@fe3.columbus.rr.com>:
Umm....okay. I really just thought there would be some
(hopefully easy) way to refer to the email field in the form.
You all say it's pretty easy, yet can't give me code...sry, I
don't see why :-\


Do you want the code in Perl? Python? C? What do you have available
on the server?

For Perl, check the CGI module man page. perldoc CGI.

--
Rob - http://rock13.com/
Web Stuff: http://rock13.com/webhelp/
Jul 20 '05 #4

"Rob McAninch" <ro****@excite.com> wrote in message
news:Xn***********************@24.48.107.53...
Nathaniel Maier <news:MJ***************@fe3.columbus.rr.com>:
Umm....okay. I really just thought there would be some
(hopefully easy) way to refer to the email field in the form.
You all say it's pretty easy, yet can't give me code...sry, I
don't see why :-\


Do you want the code in Perl? Python? C? What do you have available
on the server?

For Perl, check the CGI module man page. perldoc CGI.

--
Rob - http://rock13.com/
Web Stuff: http://rock13.com/webhelp/


The server has php4, Perl, and CGl. Is this really that hard? I would have
figured there would be some way to do it just in javascript or html. I know
C++ fairly well, and I could do that incredibly easily in C++. I would have
figured the same would be true for html. So there's really know way just to
refer to a field of a form?
Jul 20 '05 #5
Nathaniel Maier wrote:
How can I send form results to an email address based on what the user
selects? e.g. not to the same address all the time, and not to all
addresses, but to the one that the user selects. How can I refer to

Include a field on the report that identifies the desired recipient.
Have the form script email the results to that person.


Thx, but could you show me some code? Sry I rarely hard code HTML...so if it
isn't too much of a problem could you elaborate a bit more and show some
code? Thanks.


You mean code for the form? Find a contact form on the web and look
at the source code.

--
Brian
follow the directions in my address to email me

Jul 20 '05 #6

"Mark Parnell" <we*******@clarkecomputers.com.au> wrote in message
news:3f***********************@freenews.iinet.net. au...
Nathaniel Maier wrote:
[Sending form results to email address selected by user]

The server has php4, Perl, and CGl. Is this really that hard? I would
have figured there would be some way to do it just in javascript or
html. I know C++ fairly well, and I could do that incredibly easily
in C++. I would have figured the same would be true for html. So
there's really know way just to refer to a field of a form?
Is the user actually typing in the email address themself or are you just
giving them a few options? If they are typing it in themself, then as

Nick said, it opens it up for spam abuse. If you are just giving them a few
options - e.g. it goes to a different person in your company depending on
their needs, then yes, it can be done, but not in HTML.

ISTM that the problem is in your understanding of HTML. HTML is not a
programming language, it is a markup language (that's what the ML stands
for). It is used to describe the structure of a document. What you want to do *could* be done in JavaScript, though it won't work for all your visitors (those who have JavaScript disabled, those using text or speech browsers,
etc). It is much better done server-side.

--

Mark Parnell
http://www.clarkecomputers.com.au


No, the user just selects one from a drop down list.
Jul 20 '05 #7
Nathaniel Maier wrote:
"Mark Parnell" <we*******@clarkecomputers.com.au> wrote in message
news:3f***********************@freenews.iinet.net. au...
[Sending form results to email address selected by user]

Is the user actually typing in the email address themself or are you
just giving them a few options?


No, the user just selects one from a drop down list.


In that case, you could easily do it in your form mail script. I could give
you an example in ASP, but since you don't have access to that on your
server, that's not going to help you much. Ultimately, the answer to your
original question remains the same - yes it is possible, but not in HTML.
You will need to use a server-side script.

HTH

--

Mark Parnell
http://www.clarkecomputers.com.au
Jul 20 '05 #8
Nathaniel Maier wrote:
> How can I send form results to an email address based on
> what the user selects? e.g. not to the same address all the
> time, and not to all addresses, but to the one that the
> user selects. How can I refer to

but could you show me some code? Sry I rarely hard code HTML...


You mean code for the form? Find a contact form on the web and
look at the source code.


That's the thing...I haven't been able to find one yet, and there's
no easy way to search the internet for that :-\ That's why I came
here.


Google for "contact form."

Here's one to get you started.

< http://www.julietremblay.com/site/contact.html >

--
Brian
follow the directions in my address to email me

Jul 20 '05 #9
In article <Un***************@fe3.columbus.rr.com>, nm****@columbus.rr.com
says...

"Rob McAninch" <ro****@excite.com> wrote in message
news:Xn***********************@24.48.107.53...
Nathaniel Maier <news:MJ***************@fe3.columbus.rr.com>:
Umm....okay. I really just thought there would be some
(hopefully easy) way to refer to the email field in the form.
You all say it's pretty easy, yet can't give me code...sry, I
don't see why :-\


Do you want the code in Perl? Python? C? What do you have available
on the server?

For Perl, check the CGI module man page. perldoc CGI.

--
Rob - http://rock13.com/
Web Stuff: http://rock13.com/webhelp/


The server has php4, Perl, and CGl. Is this really that hard? I would have
figured there would be some way to do it just in javascript or html. I know
C++ fairly well, and I could do that incredibly easily in C++. I would have
figured the same would be true for html. So there's really know way just to
refer to a field of a form?


Since you "know" C++ "pretty well" then why don't you download
PHP and get busy. It is not *that* much different and the syntax
is definately comparable. What you are asking for here is for someone
to write it for you, correct?
Jul 20 '05 #10
> Eh, first, I thought it could be done in HTML or javascript. Second, I
figured it could be done in just a few lines of code if it was in php or
cgi. But I guess no one will help me, so I'll spend hours trying to learn
php just so I can use it on one form....great.


Well, it's a little more than "just a couple of lines" as you need to check
for existance of an address and so on...

try this:

<?php
// Here is a modified script form:
// http://www.stargeek.com/scripts.php?script=12&cat=blog
$mail_from = "mr*****@pandg.com";
$mail_to = $_POST['to_email'];

$mail_subject = "Contact Form";
if ($_POST)
{
if($_POST['from_email'])
{
if(mail($mail_to, $mail_subject, $_POST['from_name']."\n".$_POST
['from_mail']. "\n". $_POST['userMessage']))
{
$html = 'Your email was sent';
}
else
{
$html = 'There was an error';
}
}
}
else
{
$message = "<textarea name='userMessage'></textarea>";
$name = "<input type='text' name='from_name'>";
$reply = "<input type='text' name='from_email'>";

$addylist = "<select name='to_email'>/n";
$addylist = $addylist."<option selected value='mr*****@pandg.com'>Mr.
Clean</option>";
$addylist = $addylist."<option va***********@columbus.rr.com'>Nathaniel
Maier</option>";
$addylist = $addylist."</select>";

$send = '<input type="submit" name="submit" value="Send">';

$html = "
<p>
To Contact Stargeek:
</p>
<form action=\"$PHP_SELF\" method=\"post\">
<table class=\"bodyBlack\" border=\"0\" cellspacing=\"5\">
<tr>
<td>Your Name:$name</td>
</tr>
<tr>
<td>Your Email:$reply</td>
</tr>
<tr>
<td>Select Person to send to: $addylist</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">Additional Message
</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">$message</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">$send</td>
</tr>
</table>
</form>
";
}
?>
<html>
<head>
</head>
<body>
<?=$html?>
</body>
</html>
Jul 20 '05 #11
In article <MP************************@news-server.austin.rr.com>, one of infinite monkeys
at the keyboard of Mr. Clean <mr*****@protctorandgamble.com> wrote:
try this:


[classic spam gateway code snipped ]

Don't ever put that on the web. It's only a matter of time before
the spammers find it.

That illustrates precisely why you shouldn't try to do this unless
you properly understand the issues.

--
Nick Kew

In urgent need of paying work - see http://www.webthing.com/~nick/cv.html
Jul 20 '05 #12
In article <sq***********@jarl.webthing.com>, ni**@fenris.webthing.com says...
In article <MP************************@news-server.austin.rr.com>, one of infinite monkeys
at the keyboard of Mr. Clean <mr*****@protctorandgamble.com> wrote:
try this:


[classic spam gateway code snipped ]

Don't ever put that on the web. It's only a matter of time before
the spammers find it.

That illustrates precisely why you shouldn't try to do this unless
you properly understand the issues.

All he would have to do is check to see if the to-email matches what he has in
his select items and if they do not match, don't send anything. Spammers or
not, it wouldn't work if you didn't chose one of the items in the select.
Jul 20 '05 #13
Nathaniel Maier wrote:

> I really just thought there would be some (hopefully easy)
> way to refer to the email field in the form. You all say
> it's pretty easy, yet can't give me code...sry, I don't see
> why :-\

Do you want the code in Perl? Python? C? What do you have
available on the server?

For Perl, check the CGI module man page. perldoc CGI.

The server has php4, Perl, and CGl.


Since you "know" C++ "pretty well" then why don't you download
PHP and get busy.


But I guess no one will help me, so I'll spend hours trying to
learn php just so I can use it on one form....great.


Before getting exasperated, you should realize that your original
question was entirely clear. I thought you wanted the html code,
which is the form mark-up. It looks like you want the server-side
script to process that code. Have you Googled for form mail script?

Actually, I just did. *NB*: the first link is to Matt's Script
Archive, whose scripts have serious security flaws that allow spammers
to use your server as a mail mule. Try instead

< http://nms-cgi.sourceforge.net/ >

--
Brian
follow the directions in my address to email me

Jul 20 '05 #14

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Danny Anderson | last post: by
9 posts views Thread by eswanson | last post: by
SHOverine
4 posts views Thread by SHOverine | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.