PHP contact form doesn't send data

Hello everybody,

I implemented a contact form (not written by me) into my website. It works in that way, that it sends an e-Mail to me, but this e-mail is empty. All the inputted information are not transported. Can someone may help?

First my html-code for the form:


<form class="Kontaktformular" method="post" enctype="text/plain" action="Formular-Feedback.php">
<fieldset>

<legend>Ihre Anfrage an uns:</legend><br><br>

<label for="name">Name:</label>
<input type="text" name="name" value=""><br><br>

<label for="firma">Firma:</label>
<input type="text" name="firma" value=""><br><br>

<label for="email">E-Mail:</label>
<input type="text" name="email" value=""><br><br>

<label for="telefon">Telefon:</label>
<input type="text" name="telefon" value=""><br><br>

<label for="nachricht">Nachricht:</label>
<textarea name="nachricht" rows="12" cols="65" wrap="wrap"></textarea><br>

<input type="submit" name="Submitbutton" id="submitbutton" value="Senden">
</fieldset>
</form>

And here is the php-code:


	<?php

function clear_user_input($value) {
	if (get_magic_quotes_gpc()) $value=stripslashes($value);
	$value= str_replace( "\n", '', trim($value));
	$value= str_replace( "\r", '', $value);
	return $value;
}

$name = $_POST['name'];
$firma = $_POST['firma'];
$email = $_POST['email'];
$telefon = $_POST['telefon'];
$nachricht = $_POST['nachricht'];

$mailto = "name@example.com"; 
$mailsubj = "Kontaktanfrage von der FS-Website";

$mailhead = "From: $email\n";
reset ($_POST);

# E-Mail-Text zusammenstellen
$body ="Werte, die von der Website übermittelt wurden:\n";

foreach ($_POST as $key => $value) {
	$key = clear_user_input($key);
	$value = clear_user_input($value);
	if ($key=='extras') {	
	    if (is_array($_POST['extras']) ){
            $body .= "$key: ";
            $counter = 1;
            foreach ($_POST['extras'] as $value) {
                if (sizeof($_POST['extras']) == $counter) {
                    $body .= "$value\n";
                    break;
                }
                else {
                    $body .= "$value, ";
                    $counter += 1;
                }
		    }
        } 
        else {
            $body .= "$key: $value\n";
        }
	} 
	else {
		$body .= "$key: $value\n";
	}
}

mail($mailto, $mailsubj, $body, $mailhead);

?>

Thanks in advance!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.