benshepherd icon

PHP Feedback

benshepherd | PRO | 01/31/13 02:28:05 PM UTC | 0 ⭐ | 290 👁️ | Never ⏰ | []
PHP |

910 B

|

None

|

0 👍

/

0 👎

<?PHP
    if(isset($_GET('mail'])) && count($_POST) > 0) {
    
        $your_email = "[email protected]";
    
        $name = $_POST['name'];
        $email = $_POST['email'];
        $feedback = $_POST['feedback'];
        
        $body = "Feedback sent by $name";
        $body .= "<hr />";
        $body .= htmlspecialchars($feedback);
        $body .= "<hr />";
        $body .= "Sent at ".date("d/m/Y H:i", time())." IP: ".$_SERVER['REMOTE_ADDR'];
        $header = "Content-Type: text/html\r\nReply-To: $your_email";
        
        if(mail($your_email, "New feedback", $body, $header))
            die("Feedback sent");
        else
            die("Failed to send email");
        
    }
?>
 
<form method="post" action="index.php?mail=1">
    <p>Your name:<br /><input type="text" name="name"></p>
    <p>Your email:<br /><input type="text" name="email"></p>
    <p>Your feedback:<br /><textarea name="feedback"></textarea></p>
    <p>&nbsp;</p>
    <p><input type="submit" value="Send feedback"></p>
</form>

Comments