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