Schönen guten Abend zusammen.
Habe ein kleines Problem mit PHP. Wenn ich mein Kontaktformular absende, dann funktioniert aus irgendeinem Grunde das Nav mit seinem Farbwechsel nicht mehr, sobald die Erfolgsmeldung oder Fehlermeldung über den Versand mittels der mail-Funktion erscheint.
Der ganze Javascript-Code habe ich rausgenommen, er funktioniert ohne Probleme.
Vielen Dank im Vorraus für eure Hilfe.
MfG Sebi
Hier die Dateien:
Kontakt.php:
PHP-Code:
<?php
$email = "test@gmx.de";
$subject = "neue Kontaktmitteilung auf Website: Test GmbH";
$name = "Mustermann";
$website = "www.test.de";
?>
<!DOCTYPE>
<html>
<head>
<meta charset="ISO-8859-1">
<link rel="SHORTCUT ICON" type="image/png" href="/favicon.png">
<link rel="stylesheet" type="text/css" href="/CSS/Self-CSS.css">
<title> Test GmbH - Kontakt </title>
<script charset="utf-8" src="http://code.jquery.com/jquery-1.6.1.min.js"> </script>
<script>
...
</script>
</head>
<body>
<div id="logo"> <img src="./Logo/Logo.jpg" alt="Logo" title="Logo"></div>
<div id="top-background"> </div>
<header>
<nav>
<ul>
<li> <a href="Index.html"> Home </a> </li>
<li> <a href="Aktuelles.html"> Aktuelles </a> </li>
<li> <a href="Unternehmen.html"> Unternehmen </a> </li>
<li> <a href="Impressum.html"> Impressum </a> </li>
<li class="selected" id="last-child"> <a href="Kontakt.php"> Kontakt </a> </li>
</ul>
</nav>
</header>
<?php
if(empty($_POST['abschicken'])) {
echo '<br>
<br>
<br>
<div> <h1> <nobr> Haben Sie Fragen, Anregungen oder Kritik? </nobr> </h1> </div>
<br>
<form action="/Kontakt.php" method="POST" name="kontaktformular" id="kontaktformular" onsubmit="return validateMessage();">
<div class="form">
<label for="Anrede"> Anrede* </label>
<select id="anrede" onchange="Anredetyp();"> <option> Frau </option>
<option> Herr </option>
<option> Familie </option>
<option> Firma </option> </select> <br />
<input type="hidden" name="anrede" id="anredetrans" value="Frau">
<label for="Titel"> Titel </label>
<input type="text" name="titel" maxlength="40" size="50"> <br />
<label for="Name" id="nametitle"> Name* </label>
<input type="text" id="name" name="name" maxlength="40" size="50" onkeydown="nameChange();"> <br />
<h2 id="name-error" style="display:none; color:red;"> Sie haben vergessen Ihren Nachnamen/Firmennamen einzugeben! </h2>
<label for="Vorname" id="vornametitle"> Vorname* </label>
<input type="text" name="vorname" id="vorname" maxlength="40" size="50" onkeydown="vornameChange();"> <br />
<h2 id="vorname-error" style="display: none; color: red;"> Sie haben vergessen Ihren Namen einzugeben! </h2>
<label for="Straße"> Straße / Haus-Nr. </label>
<input type="text" name="straße" maxlength="40" size="42">
<input type="text" name="hausnr" maxlength="5" size="1"> <br />
<label for="PLZ"> PLZ / Ort </label>
<input type="text" name="plz" maxlength="5" size="2">
<input type="text" name="ort" maxlength="40" size="41"> <br />
<label for="Telefon"> Telefon </label>
<input type="text" name="telefon" maxlength="30" size="50"> <br />
<label for="Telefax"> Telefax </label>
<input type="text" name="telefax" maxlength="30" size="50"> <br />
<label for="Handy"> Handy </label>
<input type="text" name="handy" maxlength="30" size="50"> <br />
<label for="E-Mail" id="emailtitle"> E-Mail* </label>
<input type="text" name="email" maxlength="30" size="50" id="email" onkeydown="emailChange();"> <br />
<h2 id="email-error" style="display:none; color:red;"> Sie haben vergessen Ihren E-Mail einzugeben! </h2>
<h2 id="validate-email-error" style="display:none; color:red;"> Sie haben eine falsche E-Mail Adresse eingeben! </h2>
</div>
<div class="clear"> </div>
<div id="display"> 1000 Zeichen </div>
<div class="form">
<label for="Nachricht" id="messagetitle"> Ihre Nachricht* </label>
<textarea name="message" id="message" onFocusIn="blank();" onkeyup="display();" onkeydown="display();">Ihre Nachricht an uns!</textarea> <br />
<div id="message-length-error"> </div>
</div>
<div id="submitbutton">
<h2 id="message-error" style="display: none; color: red;"> Sie haben vergessen Ihre Nachricht an uns einzugeben! </h2>
<input type="submit" id="submit" name="abschicken" value="Nachricht abschicken" class="button">
<br>
<p> Pflichtangaben sind mit * gekennzeichnet! </p>
</div>
</form>
<br>';
}
else {
$abs_anrede = $_POST['anrede'];
$abs_titel = $_POST['titel'];
$abs_name = $_POST['name'];
$abs_vorname = $_POST['vorname'];
$abs_straße = $_POST['straße'];
$abs_hausnr = $_POST['hausnr'];
$abs_plz = $_POST['plz'];
$abs_ort = $_POST['ort'];
$abs_telefon = $_POST['telefon'];
$abs_telefax = $_POST['telefax'];
$abs_handy = $_POST['handy'];
$abs_email = $_POST['email'];
$abs_message = $_POST['message'];
$message = "Hallo $name!\n\n $abs_anrede $abs_name hat dir auf deiner Website per Kontaktformular folgenden Text geschickt:\n _______\n$abs_message\n_______\n";
$senden = mail($mail, $subject, $message,"From: $abs_email");
if($senden){
echo '<div class="form"> <h3> Ihre Nachricht wurde erfolgreich an uns versandt. Vielen Dank! <br> Wir werden in Kürze mit Ihnen Kontakt aufnehmen. </h3> </div>';
}
else {
echo '<div class="form"> <h3 style="color: red"> Ihre Nachricht konnte aufgrund eines technischen Fehlers leider nicht an uns versandt werden. Probieren Sie es bitte zu einem späteren Zeitpunkt noch einmal oder auf den sonstigen <a href="Impressum.html"> Kommunikationswegen. </a> </h3> </div>';
}
}
?>
</body>
</html>
Self-CSS.css:
Code:
/* General */
html {
background: #686868;
}
body {
margin: 5px auto;
background: white;
height: auto;
width: 1024px;
max-width: 1024px;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
box-shadow: 0px 5px 10px 10px black;
border: 10px;
border-color: black;
}
body>:first-child {
margin: 0;
padding-top: 1em;
}
body>p {
padding-left: 50px;
padding-right: 50px;
}
#logo img {
float: left;
margin-top: -10px;
width: 300px;
height: 160px;
border-top-left-radius: 15px;
}
#logo {
color: white;
position: absolute;
}
#top-background {
margin: 0 0 0 300px;
background-image:url("/top.jpg");
height: 180px;
width: 724px;
border-top-right-radius: 15px;
border-top-left-radius: 15px;
}
/* Navigation */
header nav, header nav ul{
position: relative;
width: 1025px;
background-color: black;
padding: 0;
margin: 0;
}
header nav li {
padding-right: 2px;
list-style: none;
float: left;
background-color: black;
text-align: center;
color: white;
margin: 0px 0px 10px 0px;
font-size: 20px;
width: 203px;
}
#last-child {
width: 204px;
padding-right:0px;
}
header nav a:link, header nav a:visited {
background: black;
color: white;
font-size: 16px;
width: 204px;
font-family: Verdana;
font-weight: bold;
text-decoration:none;
height: 30px;
position: absolute;
padding: 10px 0 0 0;
}
header nav a:link {
margin: 0 0 10px 0;
}
header nav a:hover {
color: white;
background: #006699;
background: -moz-linear-gradient(top, #006699 1%, #030066 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(1%,#006699), color-stop(100%,#030066));
background: -webkit-linear-gradient(top, #006699 1%,#030066 100%);
background: -o-linear-gradient(top, #006699 1%,#030066 100%);
background: -ms-linear-gradient(top, #006699 1%,#030066 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#006699', endColorstr='#030066',GradientType=0 );
background: linear-gradient(top, #006699 1%,#030066 100%);
}
.selected, header nav ul .selected a {
background: #006699;
background: -moz-linear-gradient(top, #006699 1%, #030066 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(1%,#006699), color-stop(100%,#030066));
background: -webkit-linear-gradient(top, #006699 1%,#030066 100%);
background: -o-linear-gradient(top, #006699 1%,#030066 100%);
background: -ms-linear-gradient(top, #006699 1%,#030066 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#006699', endColorstr='#030066',GradientType=0 );
background: linear-gradient(top, #006699 1%,#030066 100%);
}
/* Kontakt */
div h1 nobr {
font-family: Verdana;
font-size: 18px;
padding: 300px;
}
.form, #submitbutton{
position: relative;
padding-left: 90px;
padding-top: 20px;
}
form#kontaktformular {
width: 650px;
margin-left: 200px;
border: 1px #c4c4c4 solid;
}
form#kontaktformular label {
width: 160px;
height: 22px;
margin-top: 5px;
display: block;
float: left;
font-family: Verdana;
font-size: 14px;
}
form#kontaktformular #display {
padding-right: 60px;
color: #888888;
text-align: right;
margin-bottom: -15px;
}
form#kontaktformular textarea {
max-width: 340px;
width: 340px;
height: 160px;
border: 1px #c4c4c4 solid;
margin-top: 5px;
font-family: Verdana;
font-size: 14px;
float: left;
margin-bottom: -5px;
}
form#kontaktformular #submit {
margin-right: 60px;
float:right;
}
form#kontaktformular br {
clear: both;
}
form#kontaktformular p {
font-family: Verdana;
font-size: 13px;
}
form#kontaktformular h2 {
font-size: 12px;
font-family: Verdana;
padding-left: 161px;
}
.form h3 {
margin-right: 100px;
padding-top: 180px;
text-align: center;
font-size: 18px;
font-family: Verdana;
}