Help with a simple email form please

liunx

Guest
Hey everyone I'm working on an email submit form and need your help.<br />
<br />
When this form is submitted, I want to pull the value from the "student_name" field and add it to my MAILTO:?subject= line.<br />
<br />
[If it worked properly I'd end up with an email that contains the form's contents and had "OJT Weekly Time sheet for "STUDENT_NAME"" as the subject.]<br />
<br />
My code looks like this so far:<br />
<br />
<FORM NAME = "form" ACTION = "mailto:[email protected]?subject=OJT Weekly Time Sheet for "form.STUDENT_NAME.value" METHOD = "POST" ENCTYPE = "text/plain"><br />
<br />
...<INPUT name="STUDENT_NAME" TYPE="TEXT" SIZE="30">...<br />
<br />
I hope I've made my idea clear enough but it's kinda hard to explain. Does ANYBODY have an idea as to how I can make this subject addition happen? I know it has to be something really easy that I'm just missing. Help please. :confused:<!--content-->I think you can do this (untested):<br />
<br />
<form name="form" action="mailto:[email protected]?subject=OJT Weekly Time Sheet" method="POST" enctype="text/plain" onsubmit="this.action = 'mailto:[email protected]?subject=OJT Weekly Time Sheet for ' + document.form.STUDENT_NAME.value"><br />
<br />
Adam<!--content-->*Note html forms will only work if a user has a mail client on their computer. It is much safer to design or get a premade mail application that uses a server side language and use your hosts smtp server.<!--content-->You could do it easily with this (<!-- m --><a class="postlink" href="http://www.webdevfaqs.com/php.php#mailer">http://www.webdevfaqs.com/php.php#mailer</a><!-- m -->) form processor.<br />
<br />
Just change $subject = "Results from your Request Info form"; #set the subject line to something like this:<br />
<br />
$subject = $_POST['STUDENT_NAME']; #set the subject line<!--content-->Sorry, I should have pointed out that a server-side script would be better. :o <br />
<br />
Pyro, it looks like webdevfaqs.com could be quite useful - nice work!<br />
<br />
Adam<!--content-->Hey everyone thanks for your help. I appreciate the suggestion of using server-side app but in my situation the only people with access to this form have email clients installed (school/educational use).<br />
<br />
Adam, thanks a bunch for the help- it did exactly what I was trying to accomplish.<!--content-->Thanks, Adam, and we're looking for people to contribute content, so if you are interested, get in touch with me. Our hopes are that this site will answer many of the frequently asked questions on these forum, and we can save all of the prolific posters time by their being able to link to webdevfaqs.com....<br />
<br />
So, let me know if you'd be interested in contributing... :)<!--content-->
 
Back
Top