Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

email a form as an attachment?

Status
Not open for further replies.

slobad23

IS-IT--Management
Joined
Jun 30, 2006
Messages
90
Location
GB
Here is what i would like to do. Basically i want to put a page on a few PC's on a server and i want them to be able to click a button that emails the completed form to me.

Here is a really simple example:

the form has a text box for notes and a combo box with the name of who they wish to have a meeting with. i want the button to open up outlook express (for which i am using the mail.to command) but i want the email to contain, either as an attachment or as the content of the email itself, whatever is being displayed on the form once they click the button.

How is this done?
 
you're lucky, i felt generous. here's a complete working example...

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Untitled</title>
<script type="text/javascript"><!--

function doSubmit() {
    var f = document.forms['f'];
    var e = f.elements;
    var a = "mailto:my@email.com&subject=Meeting Request&body=";
    a += "comments: " + e['comments'].value + ", ";
    a += "person: " + e['person'].options[e['person'].selectedIndex].value;
    
    f.action = a;
}

//--></script>
</head>

<body>

<form name="f" onsubmit="doSubmit();">
    <input type="text" name="comments" />
    <select name="person">
        <option value="Cory Arthus">Cory</option>
        <option value="David Wright">David</option>
        <option value="Carlos Beltran">Carlos</option>
    </select>
    <input type="submit" />
</form>

</body>
</html>



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
You my friend, are a living legend.

Thank you very much!!!
 
i know.

just remember, as always, that people could potentially have javascript disabled on their machines - rendering the code above useless. the most robust way to handle this is with some server-side code that will generate and send the email for you, but that's a discussion for another forum.



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top