473,473 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Should be easy - Variable to email?

This is a novice question, but I'm stumped. I have a variable with a bunch
of text assigned to it. Now I want to email the value of the variable. I
have a simple form that asks for their name and emails that, but how do I
add the variable result?

Thanks much,
Larry
Jul 23 '05 #1
3 1836
In article <vu*******************@twister.socal.rr.com>,
la***@somewhereinhawaii.com enlightened us with...
This is a novice question, but I'm stumped. I have a variable with a bunch
of text assigned to it. Now I want to email the value of the variable. I
have a simple form that asks for their name and emails that, but how do I
add the variable result?


If you are mailing server-side, as is most stable and robust for internet
applications, you do it with the server-side language of choice.

If you are using mailto as a form action, it's not good for this. You would
basically have to have a javascript handler for the form that writes the
value of the variable to a hidden form field and then submits the form, then
when the form is mailed, you'll get the value in there. Obviously it wouldn't
work for users without script.

There are a lot of possible problems with using mailto for internet apps, so
if you are, you might want to look in the archives and decide if it's really
want you want to use.

--
--
~kaeli~
Synonym: the word you use in place of a word you can't
spell.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
Larry L wrote:
This is a novice question, but I'm stumped. I have a variable with a bunch
of text assigned to it. Now I want to email the value of the variable. I
have a simple form that asks for their name and emails that, but how do I
add the variable result?

Thanks much,
Larry


<form method="POST" action="sendmail.cgi">
<script type="text/javascript">
document.write('<input type="hidden" name="stuff" value="' + yourVariable +
'">');
</script>
<input type="submit" value="Send Stuff">
</form>

If yourVariable may contain quotation marks or new line characters, you must
either remove them, replace them, or escape them.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #3
In article <41***************@agricoreunited.com>, Grant Wagner <gw*****@agricoreunited.com> wrote:
Larry L wrote:
This is a novice question, but I'm stumped. I have a variable with a bunch
of text assigned to it. Now I want to email the value of the variable. I
have a simple form that asks for their name and emails that, but how do I
add the variable result?

Thanks much,
Larry


<form method="POST" action="sendmail.cgi">
<script type="text/javascript">
document.write('<input type="hidden" name="stuff" value="' + yourVariable +
'">');
</script>
<input type="submit" value="Send Stuff">
</form>

If yourVariable may contain quotation marks or new line characters, you must
either remove them, replace them, or escape them.


Grant,

Well it took me this long to understand what is happening in my page. Your
script, of course, works perfectly by itself. However, on my page I do
several things, requiring user input, to create the variable that I then
want to send via formmail. As I understand it, your code executes as the
page loads, and at that point the variable is empty. I have a form
that runs some other javascript that creates the value (a string) in the
variable, then I have a simple second form with a button you click to
display it, then a third form that asks for yor name, and sends the
name and string via email. The first 2 are working. Any further
suggestions for the 3rd?

Thanks much,
Larry
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
55
by: Elijah | last post by:
I have read many of the topics on learning C++ or Java first. It seems like everyone says something different. I would like to know if I should learn C++ or Java. First a little about myself. I...
64
by: Morgan Cheng | last post by:
Hi All, I was taught that argument valuse is not supposed to be changed in function body. Say, below code is not good. void foo1(int x) { x ++; printf("x+1 = %d\n", x); } It should be...
14
by: David Lozzi | last post by:
Hello, I am in need of some advice. I want to move to .Net 2.0 and Visual Studio 2005 for ASP.NET developement, however I'm hesitant. Here are a few questions I have regarding the upgrade: 1)...
6
by: Mark Walsh | last post by:
The following is an explanation of a bug that exists in the VB.NET compiler. I've tried to report it to Microsoft, but they've made it so difficult I've given up: MSDN help states that variables...
2
by: walterbyrd | last post by:
I am trying to get user input from a php form. Problem is: the form doesn't wait for the user to press the submit button, but falls right through. Therefore the variable I am trying to get, is...
8
by: mindwarp | last post by:
Hi, When a user submits / posts data my php script Inserts data into my database. If they refresh the script or click back and click submit again I get duplicate record. Is there an easy...
4
by: shall | last post by:
I have several pages ( ASP) that were working OK on NT4. We moved it to Server 2003. At random , it appears that the Server.CreateObject fails. I've looked through the code and it looks OK. ...
4
by: sinbad | last post by:
how can i write a program, which should accept input as NAME of a variable in the program and print it's value.Is this possible. for example. int main () { int x,y,z; x = 10; y = 20; z = 30;
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.