html5 - sending email upon hitting submit in html or php -
i have simple site 3 input forms: first name, last name, , email address fields user fill out. want them able fill 3, , when hitting submit, email generated autofilled text, example:
email: user put email subject make, like, "regarding _"
and body of email use first , last name entered so:
dear __ __,
click here fill out bla bla bla etc
how go doing this?
any helpful links or tutorials fantastic
you can make simple html , process php. can :
index.php:
<form action='sendmail.php' method='post'> <table> <tr> <td>firstname</td> <td><input name="firstname" /></td> </tr> <tr> <td>lastname</td> <td><input name="firstname" /></td> </tr> <tr> <td>lastname</td> <td><input name="lastname" /></td> </tr> <tr> <td>email</td> <td><input name="email" /></td> </tr> <tr> <td colspan="2"><input type='submit' value='send' /></td> </tr> </table> </form>
sendmail.php:
$firstname = $_post['firstname']; $lastname = $_post['lastname']; $email = $_post['email']; //build email content $emailsubject = "email subject"; $mailcontent = "regarding ".$firstname." ".$lastname; $mailcontent .= "more content here"; //send mail if(mail($email,$emailsubject,$mailcontent)) echo "mail send successful"; else echo "mail send fail";
notice: suppose input param valid send mail. should add more validation input field.
Comments
Post a Comment