"switch" in Mail-Skript macht Probleme...

freeknow

Grünschnabel
Liebes Forum,
seit Stunden bastle ich an folgendem Code rum (bin blutiger Anfänger) und komme doch zu keinem Ergebnis,
die Mails kommen ständig leer an! (Liegt vielleicht auch an der Uhrzeit)... Würde mich über eure Rückmeldung freuen.
Vielen Danke einstweilen:

Formular:
PHP:
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html> 

<head> 
	 <title>Testpage</title>
</head> 


<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> 

									<form action="anmeldung-send.php" method="post" name="Formular">
			 						<table border="0" cellpadding="0" cellspacing="0">
									<tr>
				  						<td width="95"><div class="text"><b><font color="#388ACA">HOCHSCHULE:</font></b></div></td>
										<td><select style="font-family:Arial;font-size:12" name="select_uni" size="1" style="width: 182px">
	<option>Auswahl</option>
<option>A</option>
<option>B</option>
											</select>
										</td>
									</tr>
									<tr>
				  						<td width="95"><div class="text"><b><font color="#388ACA">NACHNAME:</font></b></div></td>
				  						<td><input style="font-family:Arial;font-size:12" type="TEXT" name="name" style="width: 182px" value="<? if(isset($name)) echo $name; ?>"></td>
									</tr>
									<tr>
				  						<td><div class="text"><b><font color="#388ACA">VORNAME:</font></b></div></td>
				  						<td><input style="font-family:Arial;font-size:12" type="TEXT" name="vorname" style="width: 182px" value="<? if(isset($vorname)) echo $vorname; ?>"></td>
									</tr>
									<tr>
				  						<td><div class="text"><b><font color="#388ACA">GESCHLECHT:</font></b></div></td>
				  						<td valign="TOP" align="left">
											<table border="0" cellpadding="0" cellspacing="0" align="LEFT">
							 				<tr>
												<td><div class="drop"><font color="#388ACA"><b>weiblich</b></font></div></td>
												<td><input type="radio" name="geschlecht" checked="checked" value="weiblich">&nbsp;&nbsp;&nbsp;&nbsp;</td><td><div class="drop"><font color="#388ACA"><b>m&auml;nnlich</b></font></div></td>
												<td align="left"><input type="radio" name="geschlecht" value="maennlich"></td>
					 						</tr>
				  							</table>
										</td>
									</tr>
									<tr>
				  						<td><div class="text"><b><font color="#388ACA">ADRESSE:</font></b></div></td>
				  						<td><input style="font-family:Arial;font-size:12" type="TEXT" name="adresse" style="width: 182px" value="<? if(isset($adresse)) echo $adresse; ?>"></td>
									</tr>
									<tr>
				  						<td>&nbsp;</td>
				  						<td><input style="font-family:Arial;font-size:12" type="TEXT" name="adresse1" style="width: 182px" value="<? if(isset($adresse1)) echo $adresse1; ?>"></td>
									</tr>
									<tr>
				  						<td>&nbsp;</td>
				  						<td><input style="font-family:Arial;font-size:12" type="TEXT" name="adresse2" style="width: 182px" value="<? if(isset($adresse2)) echo $adresse2; ?>"></td>
									</tr>
									<tr>
				  						<td><div class="text"><b><font color="#388ACA">TELEFON:</font></b></div></td>
				  						<td><input style="font-family:Arial;font-size:12" type="TEXT" name="fon" style="width: 182px" value="<? if(isset($fon)) echo $fon; ?>"></td>
									</tr>
									<tr>
				  						<td><div class="text"><b><font color="#388ACA">FAX:</font></b></div></td>
				  						<td><input style="font-family:Arial;font-size:12" type="TEXT" name="fax" style="width: 182px" value="<? if(isset($fax)) echo $fax; ?>"></td>
									</tr>
									<tr>
				  						<td><div class="text"><b><font color="#388ACA">EMAIL:</font></b></div></td>
				  						<td><input style="font-family:Arial;font-size:12" type="TEXT" name="email" style="width: 182px" value="<? if(isset($email)) echo $email; ?>"></td>
									</tr>
									<tr>
				  						<td colspan="2"><div class="text"><b><font color="#FF0000">Bitte geben Sie eine g&uuml;ltige E-Mail-Adresse an!<br><br></font></b></div></td>
									</tr>
									<tr>
				  						<td width="95"><div class="text"><b><font color="#388ACA">GEBURTSDATUM:</font></b></div></td>
				  						<td><input style="font-family:Arial;font-size:12" type="TEXT" name="datum" style="width: 182px" value="<? if(isset($datum)) echo $datum; ?>"></td>
									</tr>
									<tr>
				  						<td><div class="text"><b><font color="#388ACA">STUDIENGANG:</font></b></div></td>
				  						<td><input style="font-family:Arial;font-size:12" type="TEXT" name="studiengang" style="width: 182px" value="<? if(isset($studiengang)) echo $studiengang; ?>"></td>
									</tr>
									<tr>
				  						<td><div class="text"><b><font color="#388ACA">MATRIKELNR.:</font></b></div></td>
				  						<td><input style="font-family:Arial;font-size:12" type="TEXT" name="matrikelnr" style="width: 182px" value="<? if(isset($matrikelnr)) echo $matrikelnr; ?>"></td>
									</tr>
									<tr>
				  						<td><div class="text"><b><font color="#388ACA">SEMESTER:</font></b></div></td>
				  						<td><input style="font-family:Arial;font-size:12" type="TEXT" name="semester" style="width: 182px" value="<? if(isset($semester)) echo $semester; ?>"></td>
									</tr>
									<tr>
				  						<td valign="top"><div class="text"><b><font color="#388ACA"><br>SONSTIGE<br>MITTEILUNGEN:</font></b></div></td>
				  						<td><textarea style="font-family:Arial;font-size:12" name="mitteilung" rows="6" cols="20" style="width: 182px"><? if(isset($mitteilung)) echo $mitteilung; ?></textarea></td>
									</tr>
									<tr>
										<td></td>
										<td align="center"><br><input type="SUBMIT" name="send" value="senden">&nbsp;<input type="reset" name="delete" value="l&ouml;schen"></td>
									</tr>
			 						</table>
									</form>		</body>
</html>

und das ist das sendscript:
PHP:
<?PHP

{

switch ($select_uni)
{
    case "A":
	$sendto = "kirner.alex@target.uni-eom.de";
	$bmessage = "Vielen Dank f&uuml;r Ihre Anmeldung zur Infoveranstaltung.";
	break;
    case "B":
	$sendto = "b.may@target.uni-eom.de";
	$bmessage = "Vielen Dank f&uuml;r Ihre Anmeldung zur Infoveranstaltung";
	break;
}
 
$header = "MIME-Version: 1.0\n"; 
$header .= "Content-type: text/html; charset=UTF-8\n";  
$header .= "From: info@target.uni-eom.de\n";
  
$message  = "Anmeldung an der Auftaktveranstaltung ".$select_uni."\n\n";
$message .= "Name:         ". $name . "\n";
$message .= "Vorname:      ". $vorname . "\n";
$message .= "Geschlecht:   ". $geschlecht . "\n";
$message .= "Adresse:      ". $adresse . "\n";
$message .= "              ". $adresse1 . "\n";
$message .= "              ". $adresse2 . "\n";
$message .= "Telefon:      ". $fon . "\n";
$message .= "Fax:          ". $fax . "\n";
$message .= "E-Mail:        ". $email . "\n";
$message .= "Geburtsdatum: ". $datum . "\n";
$message .= "Studiengang:  ". $studiengang . "\n";
$message .= "Matrikelnr.:  ". $matrikelnr . "\n";
$message .= "Semester:     ". $semester . "\n\n";
$message .= "Datum:     ".date("d. m. (M) Y - H:i")." Uhr\n\n";
$message .= "Nachricht:\n". $mitteilung. "\n\n";

	mail($sendto, "Anmeldung zur Infoveranstaltung im SoSe 2014", $message, $header);
				
	mail($email, "Ihre Anmeldung zur Infoveranstaltung", $bmessage, $header);

header ("location: danke.php");

}

?>
 
Woher soll denn $select_uni kommen?
Hab das Formular nicht durchsucht ob per Zufall select_uni irgendwo vorkommt. Falls das ein Feld deines Formulares sein soll, dann hol es auch über $_POST['select_uni'] ab.

Setze Zur Sicherheit im switch() noch ein case else ab, um auch diese abzufangen, die das Feld nicht ausgefüllt haben.
 
Zurück