<?php
if ($_POST['sent'])
{
$_POST['name'] = trim($_POST['name']);
$_POST['mail'] = trim($_POST['mail']);
$_POST['site'] = trim($_POST['site']);
$_POST['text'] = trim($_POST['text']);
$_POST['method'] = trim($_POST['method']);
$msg = '';
if (empty($_POST['name']))
$msg .= "Kein Name angegeben.
\n";
if (empty($_POST['mail']))
$msg .= "Keine E-Mail angegeben.
\n";
else if (! ereg('^([A-Za-z0-9\.\_\-]{2,})@([A-Za-z0-9\.\_\-]{2,}\.[A-Za-z]{2,3})$', $_POST['mail']))
$msg .= "Keine gültige E-Mail angegeben.
\n";
/*if (empty($_POST['site']))
$msg .= "Keine Website angegeben.
\n";*/
if (empty($_POST['text']))
$msg .= "Keinen Text angegeben.
\n";
if (empty($_POST['method']))
$msg .= "Keine Antwortmöglichkeit angegeben.
\n";
switch ($_POST['method'])
{
case 'mail':
$_POST['method'] = 'E-Mail';
case 'tel':
$_POST['method'] = 'Telefon';
case 'fax':
$_POST['method'] = 'Fax';
}
if ($msg == '')
{
$to = 'xxxx@xx.de';
$subject = "Betreff";
$text = "Name: $_POST[name]\n";
$text .= "E-Mail: $_POST[mail]\n";
$text .= "Website: $_POST[site]\n";
$text .= "Text: $_POST[text]\n";
$text .= "Methode: $_Post[method]";
$mail_sent = mail($to, $subject, $text);
}
}
?>
<
html>
<head>
<style type="text/css">
body {font-family: "Verdana";}
.feld {background-color: #CCCCCC;color: #000000;border-color: #000000;border-style:solid; border-width:1px;Font-Family:Verdana;Font-Size:11px;}
</style>
</head>
<body bgcolor="#F8F8FF">
<?php
if ((! $_POST['sent']) || ($_POST['sent'] && $msg != ''))
{
echo "<div class=\"err\">$msg</div>
\n";
?>
<form action="<?php echo $_SERVER['html_SELF']; ?>" method="post">
<table>
<tr>
<td><font face="Verdana" size="2">Name:</font></td>
<td><input type="text" class="feld" name="name" value="<?php echo $_POST['name']; ?>"></td>
</tr>
<tr>
<td><font face="Verdana" size="2">E-Mail:</font></td>
<td><input type="text" class="feld" name="mail" value="<?php echo $_POST['mail']; ?>"></td>
</tr>
<tr>
<td><font face="Verdana" size="2">Website:</font></td>
<td><input type="text" class="feld" name="site" value="<?php echo $_POST['site']; ?>"></td>
</tr>
<tr>
<td><font face="Verdana" size="2">Text:</font></td>
<td><textarea cols="45" class="feld" rows="10" name="text"><?php echo $_POST['text']; ?></textarea></td>
</tr>
<tr>
<td><font face="Verdana" size="2">Antwort per:</font></td>
<td>
<font size="1">
<input type="radio" name="method" value="mail" <?php echo (($_POST['method'] == 'mail' || empty($_POST['method'])) ? ('checked') : ('')); ?>>E-Mail
<input type="radio" name="method" value="tel" <?php echo (($_POST['method'] == 'tel') ? ('checked') : ('')); ?>>Telefon (bitte separat angeben)
<input type="radio" name="method" value="fax" <?php echo (($_POST['method'] == 'fax') ? ('checked') : ('')); ?>>Fax (bitte separat angeben)
</font>
</td>
</tr>
<tr>
<td></td>
<td><input type="hidden" name="sent" value="1"><input type="submit" value="Absenden"> <input type="reset" value="Löschen"></td>
</tr>
</table>
</form>
<?php
}
else
{
if ($mail_sent)
echo "
Vielen Dank für Ihre Rückmeldung, wir werden uns schnellstmöglich bei Ihnen melden.</p>\n";
else
{
echo "
Beim Versenden der Nachricht trat leider ein Fehler auf!</p>\n";
echo "
Sie können die folgende Nachricht einfach per Mail an <a href=\"mailto:$to\">[i]$to[/i]</a> mit dem Betreff [i]$subject[/i] senden:</p>\n";
echo "<textarea cols=\"45\" rows=\"10\">$text</textarea>";
}
}
?>
</body>
</
html>