PDA

View Full Version : help with form mail


Siten0308
August 30th, 2006, 06:50 PM
hey guys,

I need help, but a quick note, if your answers are just going to send me links, not cool, unless its help to illistrate the answer to the problem. Ok, what I am trying to do for my school project, I have set up a little application page, inlcudes like 6 lines of info, what I want the website to do is once the click on the "submit resume" button it should shoot to my email address that I made up at employment@yahoo.com or maybe my outlook. so far I have tried the techniques of the book such as Mailto:(youremail).com, but nothing, the good news it brings up the info but it does not email right away, it shows my info on an outlook email ready to be sent, but you have to click on send, not convenient, or a passing grade. Please help, as i said, I need help using formmail, just want a form from a webpage be sent to my email automatically. can you help pro'S?

Thanks

ohh PS.

Here is the code I am using, i am only showing part what needs to be shown:
<form method="get" action="mailto:employment@yahoo.com" ></td>

please help and thanks

degsy
August 30th, 2006, 07:31 PM
Welcome :)

mailto is doing exactly what it is designed to do.
It is not a recommended way of sending an email. You really need a server side script to process the form

PERL - http://www.scriptarchive.com/formmail.html
ASP - http://www.brainjar.com/asp/formmail/
PHP - http://www.dtheatre.com/scripts/formmail.php

Siten0308
August 30th, 2006, 11:58 PM
once I get the script, which I think I will choose perl, since is common, if you recommend something else, then please tell : ) but anyways, after I create the script from perl, where do I move it to, the server that will be running the html's?

Thanks for the help

degsy
August 31st, 2006, 10:06 AM
I would recommend PHP or ASP before PERL. They are much easier to setup.

PHP would be more common. The instructions are in the link. You just need to edit a few variables in the setup file then upload it to your website.

karlosio
September 13th, 2006, 02:27 AM
Try this :)


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Send me the Form</title>

<script type="text/JavaScript">
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>

<body>

<p class="p">Please contact us if you have any comments or suggestions for the site or if you wish to link swap with us.</p>
<?php
if( isset($_POST['submit'])) { // if the forms submit button is clicked set up email variables
$youremail = "something@domain.com"; // The email address that is receiving the comments.
$yoursubject = "New Comment!"; // The subject of the email being sent.

$fullname = $_POST['fullname']; // The commenter's name.
$email = $_POST['email']; // The commenter's email address.
$reason = $_POST['reason']; // Reason for contact.
$subject = $_POST['djsubject']; // Subject
$message = $_POST['message']; // Message.
$ip = $_SERVER['X_FORWARDED_FOR'] ? $_SERVER['X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; //Gets the IP Address of the submitter

//sends email with details of form
mail("$youremail", "$yoursubject", "Full name: $fullname \n Email: $djemail \n Reason for contact: $reason \n Subject: $subject \n Message: $message \n From IP Address: $ip"); // Mail the name, email, etc and then display the message below in the browser
echo "<p>Thankyou for your comments</p>";
} else { // if user hasnt hit submit yet output the form
?>
<form method="post" action="<?php echo $PHP_SELF; ?>">
<table width="85%" border="0" cellspacing="5" id="applyform">
<tr>
<td width="50%">Full Name</td>
<td><input name="fullname" type="text" size="30" /></td>
</tr>
<tr>
<td>Email Address</td>
<td><input name="email" type="text" size="30" /></td>
</tr>
<tr>
<td>Reason for contact</td>
<td>
<select name="reason">
<option value="feedback">Site Feedback</option>
<option value="link lwap">Link Exchange</option>
<option value="other">Other..</option>
</select></td>
</tr>
<tr>
<td>Subject</td>
<td><input name="subject" type="text" size="30" /></td>
</tr>
<tr>
<td>Message</td>
<td><textarea name="message" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><table width="50%" border="0">
<tr>
<td><input name="submit" type="submit" onclick="MM_validateForm('fullname','','R','email','','RisE mail','subject','','R','message','','R');return document.MM_returnValue" value="Submit" /></td>
<td><input type="reset" name="reset" value="Reset" /></td>
</tr>
</table></td>
</tr>
</table>
</form>
<?php
} //ends phps else statement
?>
</body>
</html>