Hey, I've been looking into email forms recently, and making them from scratch... How would I use php to submit the following html form to an email address? <html> <title>Contact Us</title> <form method="post" action="#"> First name: <input type="text" size="22" maxlength="12" name="firstname"><br /> <p> Last name: <input type="text" size="22" maxlength="36" name="lastname"><br /> <p> Select project type: <select name="type"> <option value="Web_design">Web design</option> <option value="Graphic_design">Graphic design</option> <option value="Branding">Branding</option></select><br /> <p> Your message: <br> <textarea rows="5" cols="27" name="message" wrap="physical"></textarea><br /> <p> <input type="submit" value="Submit" name="submit"> <input type="reset" value="Reset" name="reset"><br /> </form><br /> </html> Code (markup): Many thanks, Anhalo.
<?php //get data from form... $firstname=$_POST['firstname']; $lastname=$_POST['lastname']; $type=$_POST['type']; $message=$_POST['message']; $subject=$first_name . ' ' . $lastname . ' - ' . $type; //and lets send a mail... if(mail('your@mail.com',$subject,$message,'From: my mebsite')) { echo 'E-Mail was sent.'; } else { echo 'Something wrong'; } ?> PHP: Hope it works! P.S. save it as php file and change form tag's action attribute to php file path. If you didn't know