Hey everybody I want to let you know that I have undertaken the grueling task of getting the heck away from WordPress. I was so sick of the problems and updates I had to do all the time. I am now using my ezbloo system and I am integrating all my old posts into the new system. It sucks, but in the end, I will save bundles of time. I needed to keep things simple and that is why I created ezbloo. I'll have more on this later for you guys after I am done with the total integration of my old posts here. So if you are looking for a post and need it faster, shoot me an email and I will make it a priority. [email protected]

Using php to mail a form is a simple task. Grab the codes below to learn how to do it yourself. This is continuation of our last lesson "Create a Form in a PHP Function".

Edit the Functions.php File

In order to accomplish this you will edit your functions.php form to look like it does below. This will give you more form inputs like email, subject and message.
<?php

function form(){
echo '
<form method="post" action="">
<input type="text"name="firstName"placeholder="First Name"/>
<input type="email" name="email"placeholder="email"/>
<input type="text" name="subject" placeholder="subject" />
<textarea name="message"placeholder="your message here"></textarea>
<input type="submit" name="submit" value="submit"/>
</form>

';
}

?>

Edit the Index.php File

Now edit your index.php file so that you can grab the post variables in php. After grabbing the post variables you will be able to email yourself a copy.
<?php if(isset($_POST['submit'])){ echo $_POST['firstName'].' your email has been sent'; $to=$_POST['email']; $subject=$_POST['subject']; $message=$_POST['message']; $firstname=$_POST['firstName']; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); } include('functions.php'); form(); ?>
xxx