473,805 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
+ 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 1855
In article <vu************ *******@twister .socal.rr.com>,
la***@somewhere inhawaii.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="sendmai l.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*****@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq

Jul 23 '05 #3
In article <41************ ***@agricoreuni ted.com>, Grant Wagner <gw*****@agrico reunited.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="sendmai l.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
17807
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. Yahoo store was originally written in Lisp. c. Emacs The issues with these will probably come up, so I might as well mention them myself (which will also make this a more balanced
55
46019
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 know PHP, BASIC, and of course HTML. I'll be 15 years old in September. I am interested in programming GUI applications. I am also interested in programming games. I know that I should learn C++ to program games, but would learning Java make the...
64
3410
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 "refactor-ed" to be
14
1748
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) Currently I have several customers with .Net web applications I've written. If I upgrade to VS2005 and go to update these applications, will VS2005 assume .Net 2.0 and use whatever new syntax or properties? Or keep it on my current version?
6
1324
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 are initialised when they are created. This seems to be true for the following code which produces "1","2","3","4","5". (ie the variable is created when a procedure is entered and not when for-loop is entered) For i = 1 To 5
2
1503
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 never set. I know it has to be something simple, but I'm missing it. Here is the code: echo "<form action=\"$PHP_SELF\" method=\"post\">"; echo "Name of new database to create: "; echo "<br><input type=\"text\" name=\"new_db\">"; echo "<input...
8
2701
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 solution to this? Or do I need to create a hidden field which contains some sort of
4
2269
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. Is there an easy way to make sure I have Closed all CONNECTIONS RecordSets etc.
4
2162
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
9718
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10613
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10368
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9186
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3846
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.