I am building a form, and I can't collect whatever gets submitted into my email
Here is my php

<!DOCTYPE HTML>



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Untitled Document</title>
</head>

<body>
<?php
$fn = $_POST['fn'];
$name = $_POST['name'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$comments = $_POST['comments'];
$to = "email@gmail.com";
$subject = "Form Submission";

    $headers = "From: " . strip_tags($_POST["req-email"]) . "\r\n";
    $headers .= "Reply-To: ". strip_tags($_POST["req-email"]) . "\r\n";
    $headers .= "CC: email2@gmail.com\r\n"; //Check on 
    $headers .= "MIME-Version: 1.0\r\n"; //Check version
    $headers .= "Content=Type: text/html; charset=ISO-8859-1\r\n"; /* Check "/" vs. "\"  */


    $message = '<html><head>';


    $message .= '<style>';
    $message .= 'h1 {color:#000066;}';
    $message .= "table {border:1px solid black;}";
    $message .= "</style></head><body>";
    $message .= "<h1>Hello, this form has been submitted!</h1>";
    $message .= '<img src= "logo.png" />';
    $message .= '<table rules="all" style="border-color: #ffb300;" cellpadding="10">';
    $message .= '<tr style="background: #ffb300;"><td><strong>Name:</strong> </td><td>' . strip_tags($_POST['req-name']) . '</td></tr>';
    $message .= '<tr><td><strong>Email:</strong> </td><td>' . strip_tags($_POST['req-email']) . '</td></tr>';
    $message .= '<tr><td><strong>Phone:</strong> </td><td>' . strip_tags($_POST['req-phone']) . '</td></tr>';
    $message .= '<tr><td><strong>Comments:</strong> </td><td>' .strip_tags($_POST['comments']) . '</td></tr>';
$message .= "</table>";
$message .= "</body></html>";
mail($to, $subject, $message, $headers);

?>

<?php 

$Name = ""; //senders name 
$email = ""; //senders e-mail adress 
$recipient = "aol@gmail.com"; //recipient 
$mail_body = "Form Submit"; //mail body 
$subject = "Form Submit"; //subject 
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields 

mail($recipient, $subject, $mail_body, $header); //mail command :) 
?>

<?php
$to      = 'email@gmail.com';
$subject = 'Form Submit';
$message = 'Thank You For Submitting';
$headers = 'From: email@gmail.com' . "\r\n" .
    'Reply-To: email@gmail.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>


<input name="name" type="text" id="name" size="55" placeholder="Name"><br>  
        <input name="lastname" type="text" id="lastname" size="55" placeholder="Last Name"><br>
        <input name="email" type="text" id="email" size="55" placeholder="Email"><br>  
        <input name="subject" type="text" id="subject" size="55" placeholder="Phone"><br>  
        <label>Message</label><br>  
        <textarea name="message" id="message" rows="4" cols="40"></textarea><br>

<form action="" method="post">
        <input type="submit" name="submit1" value="Submit" />
</form>


</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.