< >

kontakt-formular.php


Quell Code


<?PHP

$script = 'http://' . $_SERVER["SERVER_NAME"] . $_SERVER["SCRIPT_NAME"];

$errorFields = array('firstname',
    									 'telefone',
										 'lastname',
										 'email'
										 );	

for($x=0;$x<count($errorFields);$x++)
{
	$errorClass[$errorFields[$x]] = 'inputField';
}

if(isset($_POST['submit']))
{
	
	$error = FALSE;
	foreach($errorFields as $key => $value)
	{
	
		if(empty($_POST[$errorFields[$key]]))
		{
			$error = TRUE;
			$errorClass[$value] = 'errorField';
			$errorPicture[$value] = '<img src="achtung_klein.gif">&nbsp;';
		}
	
	}

}

if($_GET['check'] == "TRUE")
{
	$errorMessage = '<table width="100%" class="errorTable"><tr><td><b>
									 Ihre Bestellung war erfolgreich!</b><br><br>
									 Vielen Dank für Ihre Bestellung des Jahresabos. 
									 Ihre Daten wurden weitergeleitet.</td></tr></table><br>';
}

if(isset($_POST['submit'])){
	
	if($error == TRUE)
	{
		$errorMessage = '<table width="100%" class="errorTable"><tr><td>
										 <img src="achtung_gross.gif"></td><td><b>Achtung!</b><br>
										 Es ist zu einem Fehler gekommen. Bitte füllen Sie alle 
										 farblich markierten Pflichtfelder aus.</td></tr></table><br>';
	}
	else
	{
		
		// Alles ist in Ordnung
		// Daten können gespeichert werden
		
		// Seite neu laden und Hinweis anzeigen
		//header("Location: $script?check=TRUE");
	}

}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Formular</title>
<link rel="stylesheet" type="text/css" href="formStyle.css">
<style>
body{
    font-family:				Verdana,Arial,sans-serif;
	FONT-SIZE: 9px;
	background-color: 			#ffffff;
}

.table { 
	font-family:				Verdana,Arial,sans-serif;
	FONT-SIZE: 9px;
	background-color: 			#ffffff;
}

.inputField 
{ 
	BORDER-RIGHT: #7f7f7f 1px solid; 
	BORDER-TOP: #7f7f7f 1px solid; 
	BORDER-LEFT: #7f7f7f 1px solid; 
	BORDER-BOTTOM: #7f7f7f 1px solid; 
	FONT-SIZE: 9px; 
	WIDTH: 100px; 
} 

.errorField 
{
	BORDER-RIGHT: #9F0004 1px solid;
	BORDER-TOP: #9F0004 1px solid;
	BORDER-LEFT: #9F0004 1px solid;
	BORDER-BOTTOM: #9F0004 1px solid;
	FONT-SIZE: 9px;
	WIDTH: 100px;
	background-color: #FFFFCC;
} 
.errorTable 
{
	BORDER-RIGHT: #9F0004 1px solid;
	BORDER-TOP: #9F0004 1px solid;
	BORDER-LEFT: #9F0004 1px solid;
	BORDER-BOTTOM: #9F0004 1px solid;
	FONT-SIZE: 9px;
	background-color: #E2E1E1;
} 
.headlineweiss
{
	background-color: #9F0004;
	color: #FFFFFF;
}
.Jahresabo
{
	FONT-SIZE: 14px;
	font-weight:bold;
}

.button
{
	FONT-SIZE: 10px; 
	BORDER-RIGHT: #000000 1px solid; 
	BORDER-TOP: #000000 1px solid; 
	BORDER-LEFT: #000000 1px solid; 
	BORDER-BOTTOM: #000000 1px solid
}

</style>
</head>

<body>
<FORM action="<?PHP echo $script; ?>" method=post>

<TABLE width="420" border=0 align="center" cellPadding=0 cellSpacing=0>
	<TR>
  	<TD bgcolor="#000000" ><IMG height=1 src="transparent.gif" width=1></TD>
	</TR>
	<TR>
		<TD height=2></TD>
	</TR>
	<TR>
		<TD height=18 class=headlineweiss>
			<div align="center"><strong>SELFPHP - Die PHP Kochzeitung</strong></div>
		</TD>
	</TR>
</table>
  
<!-- Formular Anfang -->
<TABLE width="420" align="center" border="0"  class="table">
 
	<TR>
		<TD colSpan=4><?PHP echo $errorMessage; ?></TD>
	</TR>
	<TR>
		<TD align=center colSpan=4></TD>
	</TR>
	<TR>
		<TH align=left>Firma:</TH>
			<TD><INPUT class="inputField" size="60" name="company" value="<?PHP echo $_POST['company']; ?>"></TD>
		<TH align=left>Abteilung:</TH>
			<TD><INPUT class="inputField" size="60" name="company2" value="<?PHP echo $_POST['company2']; ?>"></TD>
	</TR>
	<TR>
		<TH align=left><?PHP echo $errorPicture['gender']; ?>Anrede:</TH>
			<TD colSpan=3>
				<SELECT size="1" name="gender" class="<?PHP echo $errorClass['gender']; ?>">
				<OPTION value="" <?PHP if(empty($_POST['gender'])) echo 'selected'; ?>>Bitte ausw&auml;hlen</OPTION>
				<OPTION value="3" <?PHP if($_POST['gender'] == "3") echo 'selected'; ?>>Firma</OPTION>
				<OPTION value="2" <?PHP if($_POST['gender'] == "2") echo 'selected'; ?>>Frau</OPTION>
				<OPTION value="1" <?PHP if($_POST['gender'] == "1") echo 'selected'; ?>>Herr</OPTION>
        </SELECT>
			</TD>
	</TR>
	<TR>
		<TH align=left><?PHP echo $errorPicture['firstname']; ?>Vorname:*</TH>
			<TD><INPUT class="<?PHP echo $errorClass['firstname']; ?>" name="firstname" value="<?PHP echo $_POST['firstname']; ?>"></TD>
		<TH align=left><?PHP echo $errorPicture['lastname']; ?>Nachname:*</TH>
			<TD><INPUT class="<?PHP echo $errorClass['lastname']; ?>" name="lastname" value="<?PHP echo $_POST['lastname']; ?>"></TD>
	</TR>
	<TR>
		<TH align=left><?PHP echo $errorPicture['telefone']; ?>Telefon:*</TH>
			<TD><INPUT class="<?PHP echo $errorClass['telefone']; ?>" name="telefone" value="<?PHP echo $_POST['telefone']; ?>"></TD>
		<TH align=left>Fax:</TH>
			<TD><INPUT class="inputField" name="faximile" value="<?PHP echo $_POST['faximile']; ?>"></TD>
	</TR>
	<TR>
		<TH align=left>Mobil:</TH>
			<TD><INPUT class="inputField" name="mobilephone" value="<?PHP echo $_POST['mobilephone']; ?>"></TD>
		<TH align=left><?PHP echo $errorPicture['email']; ?>Email:*</TH>
			<TD><INPUT class="<?PHP echo $errorClass['email']; ?>" name="email" value="<?PHP echo $_POST['email']; ?>"></TD>
	</TR>
	<TR>
		<TD align=center colSpan=4><HR></TD>
	</TR>
	<TR>
		<TD align=right colSpan=4>
			<INPUT name="submit" type="submit" value="Absenden" class="button">
		</TD>
	</TR>
</TABLE>
<!-- Formular Ende -->

</FORM>
</body>
</html>