Hi,
I'm struggling with a form on my site atm.
My question is: How do I make it so that the email adress the users type into the field shows up as the sender when I recieve the email with the inputs from the form?
Hope you can help me..
- Saekiz
Hi,
I'm struggling with a form on my site atm.
My question is: How do I make it so that the email adress the users type into the field shows up as the sender when I recieve the email with the inputs from the form?
Hope you can help me..
- Saekiz
You need a server-side capable server to do this (eg. PHP)
Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
Currently: enjoying the early holidays :)Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide
Hmm.. I think my site should be able to do this..
I'm using e107 as CMS and sending through a cgi-bin sender..
- Saekiz
www.knights-nomads.dk
Ah, ok.
It looks like you can.
Try this example:
HTML Code:<?php if (isset($_POST['Submit'])) { $em = $_POST; $content = ''; foreach ($em as $s) { $content .= $s; $content .= "\r\n\r\n"; } mail('youraddress@example.com','Subject',$content); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Mail the form</title> </head> <body> <form name="form" method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>"> <p><label>Name: <input type="text" name="name"></label></p> <p><label>Age: <input type="text" name="age"></label> </p> <p>Sex: <select name="sex"> <option value="Male">Male</option> <option value="Female">Female</option> </select> </p> <p>Comments: <p> <textarea cols="50" rows="10" name="comments"></textarea> <p> <label> <input type="submit" name="Submit" value="Submit"> </label> </p> </form> </body> </html>
Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
Currently: enjoying the early holidays :)Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide
Thats a nice example.. But where do the user type in their email adress?
personally, i suggest using cgi mail form utillity offered by a lot of hosts.
put it in your form, just as a text input
and you can add other things to your form as well... the way he set up the processing email, it loops thru the email and puts all the contents into the email sectionHTML Code:<input type="text" name="email" value="" />
Last edited by boogyman; 04-30-2007 at 03:25 PM.
But to make it actually appear to be from that person, you'd have to do:Code:mail('youraddress@example.com','Subject',$content, "From: {$_POST['email']}\r\n");
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
That's XHTML.
Try this:
HTML Code:<?php if (isset($_POST['Submit'])) { $em = $_POST; $content = ''; foreach ($em as $s) { $content .= $s; $content .= "\r\n\r\n"; } mail('youraddress@example.com','Subject',$content); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Mail the form</title> </head> <body> <form name="form" method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>"> <p><label>E-Mail: <input type="text" name="email"></label></p> <p> <label> <input type="submit" name="Submit" value="Submit"> </label> </p> </form> </body> </html>
Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
Currently: enjoying the early holidays :)Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide
instead of this:
have this:PHP Code:$content = "";
foreach ($em as $s) {
$content .= $s;
$content .= "\r\n\r\n";
}
Its a much neater solution.PHP Code:$s = "\r\n\r\n";
$content = implode($s,$em) .$s;
Bookmarks