Sendmail via Formular

kreatin

Grünschnabel
Hallo liebe tutorials.de Community,

Ich habe komische Fehler im Versand einer E-Mail via Formular.
Denn wenn ich selbst das Formular, geschrieben von Profis, aus diesem Text entnehme und das abspeichere, geht das nicht an die gewünschte email zu versenden:
Quelle:SELFHTML
HTML:
<?php

### Konfiguration ###

# Bitte passen Sie die folgenden Werte an, bevor Sie das Script benutzen!

# An welche Adresse sollen die Mails gesendet werden?
$strEmpfaenger = 'vagburgart@t-online.de';

# Welche Adresse soll als Absender angegeben werden?
# (Manche Hoster lassen diese Angabe vor dem Versenden der Mail ueberschreiben)
$strFrom       = '"Formmailer" <IhrAndererName@provider.xy>';

# Welchen Betreff sollen die Mails erhalten?
$strSubject    = 'Betreff';

# Zu welcher Seite soll als "Danke-Seite" weitergeleitet werden?
# Wichtig: Sie muessen hier eine sgueltige HTTP-Adresse angeben!
$strReturnhtml = 'http://www.provider.xy/IhrName/IhreSeite.htm';

# Welche(s) Zeichen soll(en) zwischen dem Feldnamen und dem angegebenen Wert stehen?
$strDelimiter  = ":\t";

### Ende Konfiguration ###

if($_POST)
{
 $strMailtext = "";

 while(list($strName,$value) = each($_POST))
 {
  if(is_array($value))
  {
   foreach($value as $value_array)
   {
    $strMailtext .= $strName.$strDelimiter.$value_array."\n";
   }
  }
  else
  {
   $strMailtext .= $strName.$strDelimiter.$value."\n";
  }
 }

 if(get_magic_quotes_gpc())
 {
  $strMailtext = stripslashes($strMailtext);
 }

 mail($strEmpfaenger, $strSubject, $strMailtext, "From: ".$strFrom)
  or die("Die Mail konnte nicht versendet werden.");
 header("Location: $strReturnhtml");
 exit;
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
    <head>
        <title>burgart kontakt</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </head>
    <body>
        <h1>Beispielformular</h1>
        <form action="<?php print $_SERVER['PHP_SELF']; ?>" method="post">
            <!-- Hier die eigentlichen Formularfelder eintragen. Die folgenden sind Beispielangaben. -->
            <dl>
                <dt>Ihr Name:</dt>
                <dd><input type="text" name="Versender" /></dd>
                <dt>Ihre E-Mail:</dt>
                <dd><input type="text" name="E-Mail" /></dd>
                <dt>Sie k&ouml;nnen:</dt>
                <dd><input type="checkbox" name="kannwas[]" value="HTML" />HTML <input type="checkbox" name="kannwas[]" value="PHP" />PHP</dd>
                <dt>Sie sind:</dt>
                <dd><input type="radio" name="sexus" value="M" />Mann <input type="radio" name="sexus" value="Frau" />Frau</dd>
                <dt>Sie m&ouml;gen:</dt>
                <dd><select name="Browser"><option value="Opera">Opera</option><option value="Mozilla">Mozilla</option></select></dd>
                <dt>Bemerkungen:</dt>
                <dd><textarea name="Bemerkungen" rows="3" cols="20">Bemerkungen</textarea></dd>
            </dl>
            <!-- Ende der Beispielangaben -->
            <p>
            <input type="submit" value="Senden" />
            <input type="reset" value="Zurücksetzen" />
            </p>
        </form>
    </body>
</html>
Beim Senden kommt das:
und der der Leiste:
www.seite.de/<?php print $_SERVER['PHP_SELF']; ?>
Not Found
The requested URL /< was not found on this server.

Ich wünsche mir nur einfach das ich am besten über meine HTML Seite, die so aussieht,
den Inhalt versenden kann an vagburgart@t-online.de

HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Musikschule Burgart</title>

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>
	<table style="width:766px;height:810px; background:url(IMAGES/bg.jpg) no-repeat" cellspacing="0" cellpadding="0" align="center">
	  <tr>
		<td style="height:306px">
			<img alt="" src="IMAGES/logo.gif" style="margin-left:31px; margin-top:20px"><br>
			<div style="margin-left:31px; margin-top:20px">
			<a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r1','','IMAGES/l1.jpg',1)"><img alt="" src="IMAGES/l1.jpg" name="r1"></a><br>
			<a href="index-1.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r2','','IMAGES/l2-2.jpg',1)"><img alt="" src="IMAGES/l2-2.jpg" name="r2"></a><br>
			<a href="index-2.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r3','','IMAGES/l3.jpg',1)"><img alt="" src="IMAGES/l3.jpg" name="r3"></a><br>
			<a href="index-3.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r4','','IMAGES/l5.jpg',1)"><img  alt="" src="IMAGES/l5.jpg" name="r4"></a><br>
			<a href="index-4.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r5','','IMAGES/l4.gif',1)"><img  alt="" src="IMAGES/l4.gif" name="r5"></a></div>
		</td>
	  </tr>
	  <tr>
		<td style="height:380px">
			<table  cellspacing="0" cellpadding="0">
			  <tr>
				<td style="height:156px">
					<table  cellspacing="0" cellpadding="0">
					  <tr>
						<td style="width:336px;">
							<div  style="margin:1px 25px 0 51px">
								<img alt="" src="IMAGES/5-t1.gif" ><br>
								<br style="line-height:21px">
								<span ><strong>Burgart MUSIK&amp;SCHULE in Scharnebeck</strong></span><br>
Eine weitere Filiale wird am 16.09.2008 in Scharnebeck eröffnet.</div>
							<div class="line" style="margin:22px 0px 0 50px; width:262px"><img alt="" src="IMAGES/spacer.gif" width="1" height="1"></div>
						</td>
						<td style="width:430px;">
							<div class="line" style="margin:128px 0px 0 198px; width:202px"><img alt="" src="IMAGES/spacer.gif" width="1" height="1"></div>
						</td>
					  </tr>
					</table>
				</td>
			  </tr>
			  <tr>
				<td style="height:224px">
					<table  cellspacing="0" cellpadding="0">
					  <tr>
						<td style="width:472px;">
							<div  style="margin:1px 20px 0 51px">
								<img alt="" src="IMAGES/5-t2.gif" ><br>
								<br style="line-height:32px">
								<span ><strong>Haben Sie Fragen? Dann senden Sie uns eine Nachricht!</strong></span> Wir werden auf jede von Ihnen gestellte Frage schnellst möglich antworten.
							</div>
							<form id="form1" action="" enctype="multipart/form-data" name="form1">
							<table  cellspacing="0" cellpadding="0">
							  <tr>
								<td style="width:250px;">
									<div class="l_text" style="margin:10px 0px 0 51px">
									Name:<br>
									<input type="text" class="input"><br>
									<br style="line-height:2px">
									E-Mail Addresse:<br>
									<input type="text" class="input"><br>
									<br style="line-height:2px">
									Telefon:<br>
									<input type="text" class="input"><br>
									</div>
								</td>
								<td style="width:222px;">
								<br style="line-height:8px">
									<span class="l_text">Ihre Nachricht:</span>
									<textarea rows="40" cols="50"></textarea><br>
									<a href="#" onClick="document.getElementById('form1').reset()" style="margin-left:89px" class="main_text">Clear</a>
									<a href="mailto:vagburgart@t-online.de" onClick="document.getElementById('form1').submit()" style="margin-left:10px" class="main_text">Submit</a>
								</td>
							  </tr>
							</table>
							</form>
						</td>
						<td style="width:36px;">
							<table  cellspacing="0" cellpadding="0">
							  <tr>
								<td style="height:44px"></td>
							  </tr>
							  <tr>
								<td style=" background:url(IMAGES/bg-line.gif) left repeat-y"></td>
							  </tr>
							  <tr>
								<td style="height:24px"></td>
							  </tr>
							</table>
						</td>
						<td style="width:258px;">
							<img alt="" src="IMAGES/5-t3.gif" style="margin-left:9px; margin-top:2px"><br>
						  <img alt="" src="IMAGES/school.jpg" style=" margin-top:26px"><br>
							<br style="line-">
							<span ><strong>21337 Dahlenburger Landstr. 155,<br>
Lüneburg, DE </strong></span><br>
<br style="line-height:5px">
Telefon:&nbsp; &nbsp; 04131/408330<br>
E-mail: <span ><a href="#" >info@burgart-musikschule.de</a></span>						</td>
					  </tr>
					</table>
				</td>
			  </tr>
			</table>
		</td>
	  </tr>
	  <tr>
		<td style="height:124px">
			<table  cellspacing="0" cellpadding="0">
			  <tr>
				<td style="width:31px;"></td>
				<td style="width:712px; background:url(images/bg-bot.gif) top repeat-x">
					<div class="c_text" style="margin:39px 0px 0 6px">
						Copyright 2008 &copy;  All rights reserved. <a href="#" >Terms of use</a>&nbsp; |&nbsp; <a href="index-5.html" >Privacy Policy</a>
					</div>
				</td>
				<td style="width:23px;"></td>
			  </tr>
			</table>
		</td>
	  </tr>
	</table>
</body>
</html>

Denn das ist ein ferrtiges Formular das einfach nichts vershcikcen kann, wo und warum der fehler ist weiss ich nicht. Schlage mich hier durch dutzende Hilfe-forums aber alles wird so unverständlich erklärt...Im Bild was ich als anhang geshickt habe, zeigt er mir was im ersten HTML Code der Fehler ist, denn ich nicht mal verstehen kann...
Ich bitte euch vielmals um Hilfe, denn ich brauche das sehr dringend für ein Eröffnungstermin aber ich blicke je weiter ich andere foren durchblätter, wo diese sachen angesprochen werden, immer weniger durch.
Es wäre wirklich sehr liebenswürdig wenn ich da endlich durch eure erfahrene Hilfe weiter kommen könnte, den Inhalt mit dem 2 gestellten Formular abzusenden.
Hab gelesen man braucht contact.php noch dazu aber wie man des erzeugt, bin ich einfach ratlos mit PHP..
Vielen Dank,
MfG Daniel
 

Anhänge

  • fehler_nach-stdt-sendmail-formular.jpg
    fehler_nach-stdt-sendmail-formular.jpg
    120,1 KB · Aufrufe: 22
Zuletzt bearbeitet:
Hi,

dem Screenshot zufolge solltest du mal das HTML-Dokument als PHP-Datei speichern, damit der PHP-Code auf dem Server auch als solches geparst wird. Oder hast du die Seite etwa nicht über das HTTP-Protokoll aufgerufen?

Ansonsten musst du mit einer .htaccess-Datei auf dem Webserver dafür sorgen, dass *.htm- und *.html-Dateien durch den PHP-Parser geschickt werden:

Code:
AddType application/x-httpd-php .htm .html

mfg Maik
 
Das heisst, ich brauch nur die PHP-Leiste von dem Profis Formular auf meine oben einzufügen / ( übertragen) dann verschickt er das ebenfalls so? :)
wäre echt klasse wen das so gehen würde :eek:
Oder muss ich mein privates Formular /HTML Projekt anders bearbeiten
 
Kopier dir den vollständigen Quellcode des SELFHTML-Beispiels in ein leeres Dokument, nimm die Änderungen in der Konfiguration vor, und speichere die Datei mit der Dateiendung ".php" - also z.B. "contact.php".

Lad anschliessend das Dokument auf den Server, und überprüfe dort die Funktionalität des Formulars.

mfg Maik
 
Hallo Maik,
echt klasse das du so dabei bist, mir zu helfen,
aber wenn ich die fertiger datei "index-3.php" lade und das Formular ausfülle und dann auf Submit gehe, passiert nichts:
HTML:
<?php

### Konfiguration ###

# Bitte passen Sie die folgenden Werte an, bevor Sie das Script benutzen!

# An welche Adresse sollen die Mails gesendet werden?
$strEmpfaenger = 'vagburgart@t-online.de';

# Welche Adresse soll als Absender angegeben werden?
# (Manche Hoster lassen diese Angabe vor dem Versenden der Mail ueberschreiben)
$strFrom       = '"Formmailer" <info@burgart-musikschule.de>';

# Welchen Betreff sollen die Mails erhalten?
$strSubject    = 'Burgart Musikschule';

# Zu welcher Seite soll als "Danke-Seite" weitergeleitet werden?
# Wichtig: Sie muessen hier eine sgueltige HTTP-Adresse angeben!
$strReturnhtml = 'http://burgart-musikschule.de';

# Welche(s) Zeichen soll(en) zwischen dem Feldnamen und dem angegebenen Wert stehen?
$strDelimiter  = ":\t";

### Ende Konfiguration ###

if($_POST)
{
 $strMailtext = "";

 while(list($strName,$value) = each($_POST))
 {
  if(is_array($value))
  {
   foreach($value as $value_array)
   {
    $strMailtext .= $strName.$strDelimiter.$value_array."\n";
   }
  }
  else
  {
   $strMailtext .= $strName.$strDelimiter.$value."\n";
  }
 }

 if(get_magic_quotes_gpc())
 {
  $strMailtext = stripslashes($strMailtext);
 }

 mail($strEmpfaenger, $strSubject, $strMailtext, "From: ".$strFrom)
  or die("Die Mail konnte nicht versendet werden.");
 header("Location: $strReturnhtml");
 exit;
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Musikschule Burgart</title>

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<form action="<?php print $_SERVER['PHP_SELF']; ?>" method="post">
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>
	<table style="width:766px;height:810px; background:url(IMAGES/bg.jpg) no-repeat" cellspacing="0" cellpadding="0" align="center">
	  <tr>
		<td style="height:306px">
			<img alt="" src="IMAGES/logo.gif" style="margin-left:31px; margin-top:20px"><br>
			<div style="margin-left:31px; margin-top:20px">
			<a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r1','','IMAGES/l1.jpg',1)"><img alt="" src="IMAGES/l1.jpg" name="r1"></a><br>
			<a href="index-1.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r2','','IMAGES/l2-2.jpg',1)"><img alt="" src="IMAGES/l2-2.jpg" name="r2"></a><br>
			<a href="index-2.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r3','','IMAGES/l3.jpg',1)"><img alt="" src="IMAGES/l3.jpg" name="r3"></a><br>
			<a href="index-3.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r4','','IMAGES/l5.jpg',1)"><img  alt="" src="IMAGES/l5.jpg" name="r4"></a><br>
			<a href="index-4.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r5','','IMAGES/l4.gif',1)"><img  alt="" src="IMAGES/l4.gif" name="r5"></a></div>
		</td>
	  </tr>
	  <tr>
		<td style="height:380px">
			<table  cellspacing="0" cellpadding="0">
			  <tr>
				<td style="height:156px">
					<table  cellspacing="0" cellpadding="0">
					  <tr>
						<td style="width:336px;">
							<div  style="margin:1px 25px 0 51px">
								<img alt="" src="IMAGES/5-t1.gif" ><br>
								<br style="line-height:21px">
								<span ><strong>Burgart MUSIK&amp;SCHULE in Scharnebeck</strong></span><br>
Eine weitere Filiale wird am 16.09.2008 in Scharnebeck eröffnet.</div>
							<div class="line" style="margin:22px 0px 0 50px; width:262px"><img alt="" src="IMAGES/spacer.gif" width="1" height="1"></div>
						</td>
						<td style="width:430px;">
							<div class="line" style="margin:128px 0px 0 198px; width:202px"><img alt="" src="IMAGES/spacer.gif" width="1" height="1"></div>
						</td>
					  </tr>
					</table>
				</td>
			  </tr>
			  <tr>
				<td style="height:224px">
					<table  cellspacing="0" cellpadding="0">
					  <tr>
						<td style="width:472px;">
							<div  style="margin:1px 20px 0 51px">
								<img alt="" src="IMAGES/5-t2.gif" ><br>
								<br style="line-height:32px">
								<span ><strong>Haben Sie Fragen? Dann senden Sie uns eine Nachricht!</strong></span> Wir werden auf jede von Ihnen gestellte Frage schnellst möglich antworten.
							</div>
							<form id="form1" action="" enctype="multipart/form-data" name="form1">
							<table  cellspacing="0" cellpadding="0">
							  <tr>
								<td style="width:250px;">
									<div class="l_text" style="margin:10px 0px 0 51px">
									Name:<br>
									<input type="text" class="input"><br>
									<br style="line-height:2px">
									E-Mail Addresse:<br>
									<input type="text" class="input"><br>
									<br style="line-height:2px">
									Telefon:<br>
									<input type="text" class="input"><br>
									</div>
								</td>
								<td style="width:222px;">
								<br style="line-height:8px">
									<span class="l_text">Ihre Nachricht:</span>
									<textarea rows="40" cols="50"></textarea><br>
									<a href="#" onClick="document.getElementById('form1').reset()" style="margin-left:89px" class="main_text">Clear</a>
									<a href="mailto:vagburgart@t-online.de" onClick="document.getElementById('form1').submit()" style="margin-left:10px" class="main_text">Submit</a>
								</td>
							  </tr>
							</table>
							</form>
						</td>
						<td style="width:36px;">
							<table  cellspacing="0" cellpadding="0">
							  <tr>
								<td style="height:44px"></td>
							  </tr>
							  <tr>
								<td style=" background:url(IMAGES/bg-line.gif) left repeat-y"></td>
							  </tr>
							  <tr>
								<td style="height:24px"></td>
							  </tr>
							</table>
						</td>
						<td style="width:258px;">
							<img alt="" src="IMAGES/5-t3.gif" style="margin-left:9px; margin-top:2px"><br>
						  <img alt="" src="IMAGES/school.jpg" style=" margin-top:26px"><br>
							<br style="line-">
							<span ><strong>21337 Dahlenburger Landstr. 155,<br>
Lüneburg, DE </strong></span><br>
<br style="line-height:5px">
Telefon:&nbsp; &nbsp; 04131/408330<br>
E-mail: <span ><a href="#" >info@burgart-musikschule.de</a></span>						</td>
					  </tr>
					</table>
				</td>
			  </tr>
			</table>
		</td>
	  </tr>
	  <tr>
		<td style="height:124px">
			<table  cellspacing="0" cellpadding="0">
			  <tr>
				<td style="width:31px;"></td>
				<td style="width:712px; background:url(images/bg-bot.gif) top repeat-x">
					<div class="c_text" style="margin:39px 0px 0 6px">
						Copyright 2008 &copy;  All rights reserved. <a href="#" >Terms of use</a>&nbsp; |&nbsp; <a href="index-5.html" >Privacy Policy</a>
					</div>
				</td>
				<td style="width:23px;"></td>
			  </tr>
			</table>
		</td>
	  </tr>
	</table>
</body>
</html>

Link: http://www.burgart-musikschule.de/index-3.php
kannst ja überprüfen und evtl. weisst du was los ist.
 
das wird so auch nicht so einfach gehen, da du dein Formular mit JavaScript abschickst und PHP nichts übertragen wird.

Ich hab dir mal ein ganz simples Kontaktformular gebastelt und dein formular angepasst.
Kannst es ja mal vergleichen und es gegebenfalls anpassen.
Bedenke: diese Art soll nur ein Beispiel sein und kein fertiger Code. Er ist nicht sicher und kann von Spammern mißbraucht werden.

PHP:
<?php

if (isset($_POST['send']))
{
	$empfaenger = "vagburgart@t-online.de";  // Wer soll diese Mail bekommen
	$betreff = "Beispielkontaktformular"; // Betreff eingeben
	
	$name = $_POST['name'];
	$absender = $_POST['email'];
	$tel = $_POST['tel'];
	
	$mailtext = $_POST['text']."<br /><br />";
	$mailtext.= $_POST['name']."<br />";
	$mailtext.= $_POST['tel'];
	
	
	$mail = mail($empfaenger, $betreff, $mailtext, "From: $absender");
	if (!$mail)
	{
		echo "<script>alert('Leider konnte Ihre Anfrage nicht abgesendet werden.')</script>";
	}else{
		echo "<script>alert('Ihre Anfrage wurde erfolgreich gesendet.')</script>";
		}
	
}
?>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Musikschule Burgart</title>

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>
	<table style="width:766px;height:810px; background:url(IMAGES/bg.jpg) no-repeat" cellspacing="0" cellpadding="0" align="center">
	  <tr>
		<td style="height:306px">
			<img alt="" src="IMAGES/logo.gif" style="margin-left:31px; margin-top:20px"><br>
			<div style="margin-left:31px; margin-top:20px">
			<a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r1','','IMAGES/l1.jpg',1)"><img alt="" src="IMAGES/l1.jpg" name="r1"></a><br>
			<a href="index-1.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r2','','IMAGES/l2-2.jpg',1)"><img alt="" src="IMAGES/l2-2.jpg" name="r2"></a><br>
			<a href="index-2.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r3','','IMAGES/l3.jpg',1)"><img alt="" src="IMAGES/l3.jpg" name="r3"></a><br>
			<a href="index-3.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r4','','IMAGES/l5.jpg',1)"><img  alt="" src="IMAGES/l5.jpg" name="r4"></a><br>
			<a href="index-4.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r5','','IMAGES/l4.gif',1)"><img  alt="" src="IMAGES/l4.gif" name="r5"></a></div>
		</td>
	  </tr>
	  <tr>
		<td style="height:380px">
			<table  cellspacing="0" cellpadding="0">
			  <tr>
				<td style="height:156px">
					<table  cellspacing="0" cellpadding="0">
					  <tr>
						<td style="width:336px;">
							<div  style="margin:1px 25px 0 51px">
								<img alt="" src="IMAGES/5-t1.gif" ><br>
								<br style="line-height:21px">
								<span ><strong>Burgart MUSIK&amp;SCHULE in Scharnebeck</strong></span><br>
Eine weitere Filiale wird am 16.09.2008 in Scharnebeck eröffnet.</div>
							<div class="line" style="margin:22px 0px 0 50px; width:262px"><img alt="" src="IMAGES/spacer.gif" width="1" height="1"></div>
						</td>
						<td style="width:430px;">
							<div class="line" style="margin:128px 0px 0 198px; width:202px"><img alt="" src="IMAGES/spacer.gif" width="1" height="1"></div>
						</td>
					  </tr>
					</table>
				</td>
			  </tr>
			  <tr>
				<td style="height:224px">
					<table  cellspacing="0" cellpadding="0">
					  <tr>
						<td style="width:472px;">
							<div  style="margin:1px 20px 0 51px">
								<img alt="" src="IMAGES/5-t2.gif" ><br>
								<br style="line-height:32px">
								<span ><strong>Haben Sie Fragen? Dann senden Sie uns eine Nachricht!</strong></span> Wir werden auf jede von Ihnen gestellte Frage schnellst möglich antworten.
							</div>
							<form id="form1" action="<? echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data" name="form1">
							<table  cellspacing="0" cellpadding="0">
							  <tr>
								<td style="width:250px;">
									<div class="l_text" style="margin:10px 0px 0 51px">
									Name:<br>
									<input type="text" class="input" name="name" /><br>
									<br style="line-height:2px">
									E-Mail Addresse:<br>
									<input type="text" class="input" name="email" /><br>
									<br style="line-height:2px">
									Telefon:<br>
									<input type="text" class="input" name="tel" /><br>
									</div>
								</td>
								<td style="width:222px;">
								<br style="line-height:8px">
									<span class="l_text">Ihre Nachricht:</span>
									<textarea rows="40" cols="50" name="text"></textarea><br>
									<input type="button" onClick="document.getElementById('form1').reset()" style="margin-left:89px" class="main_text" name="Clear" value="clear">
									<input type="submit" name="send" style="margin-left:10px" class="main_text" value="absenden" />
								</td>
							  </tr>
							</table>
							</form>
						</td>
						<td style="width:36px;">
							<table  cellspacing="0" cellpadding="0">
							  <tr>
								<td style="height:44px"></td>
							  </tr>
							  <tr>
								<td style=" background:url(IMAGES/bg-line.gif) left repeat-y"></td>
							  </tr>
							  <tr>
								<td style="height:24px"></td>
							  </tr>
							</table>
						</td>
						<td style="width:258px;">
							<img alt="" src="IMAGES/5-t3.gif" style="margin-left:9px; margin-top:2px"><br>
						  <img alt="" src="IMAGES/school.jpg" style=" margin-top:26px"><br>
							<br style="line-">
							<span ><strong>21337 Dahlenburger Landstr. 155,<br>
Lüneburg, DE </strong></span><br>
<br style="line-height:5px">
Telefon:&nbsp; &nbsp; 04131/408330<br>
E-mail: <span ><a href="#" >info@burgart-musikschule.de</a></span>						</td>
					  </tr>
					</table>
				</td>
			  </tr>
			</table>
		</td>
	  </tr>
	  <tr>
		<td style="height:124px">
			<table  cellspacing="0" cellpadding="0">
			  <tr>
				<td style="width:31px;"></td>
				<td style="width:712px; background:url(images/bg-bot.gif) top repeat-x">
					<div class="c_text" style="margin:39px 0px 0 6px">
						Copyright 2008 &copy;  All rights reserved. <a href="#" >Terms of use</a>&nbsp; |&nbsp; <a href="index-5.html" >Privacy Policy</a>
					</div>
				</td>
				<td style="width:23px;"></td>
			  </tr>
			</table>
		</td>
	  </tr>
	</table>
</body>
</html>
 
Es kommt leider keine Funktion wenn man auf submit klickt, bestätigt er und eskomm "http://burgart-musikschule.de/index-3.php?name=&email=&tel=&text=fewg+weg+rhe&send=absenden" in der leiste aber es kommt keine email an in meinem postfach... was ist denn los ey....
 
Zuletzt bearbeitet:
hast Du auch meinen kompletten code genommen? in meinem Beispiel klickt man nicht auf submit sondern auf "absenden".

und ändere:

PHP:
<form id="form1" action="<? echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data" name="form1">

in:
PHP:
<form id="form1" action="<? echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data" name="form1" method="post">
 
Diesen Quellcode hab ich zuvor mit meiner Email-Adresse erfolgreich überprüft:
PHP:
<?php

### Konfiguration ###

# Bitte passen Sie die folgenden Werte an, bevor Sie das Script benutzen!

# An welche Adresse sollen die Mails gesendet werden?
$strEmpfaenger = 'vagburgart@t-online.de';

# Welche Adresse soll als Absender angegeben werden?
# (Manche Hoster lassen diese Angabe vor dem Versenden der Mail ueberschreiben)
$strFrom       = '"Formmailer" <info@burgart-musikschule.de>';

# Welchen Betreff sollen die Mails erhalten?
$strSubject    = 'Burgart Musikschule';

# Zu welcher Seite soll als "Danke-Seite" weitergeleitet werden?
# Wichtig: Sie muessen hier eine gueltige HTTP-Adresse angeben!
$strReturnhtml = 'http://burgart-musikschule.de';

# Welche(s) Zeichen soll(en) zwischen dem Feldnamen und dem angegebenen Wert stehen?
$strDelimiter  = ":\t";

### Ende Konfiguration ###

if($_POST)
{
 $strMailtext = "";

 while(list($strName,$value) = each($_POST))
 {
  if(is_array($value))
  {
   foreach($value as $value_array)
   {
    $strMailtext .= $strName.$strDelimiter.$value_array."\n";
   }
  }
  else
  {
   $strMailtext .= $strName.$strDelimiter.$value."\n";
  }
 }

 if(get_magic_quotes_gpc())
 {
  $strMailtext = stripslashes($strMailtext);
 }

 mail($strEmpfaenger, $strSubject, $strMailtext, "From: ".$strFrom)
  or die("Die Mail konnte nicht versendet werden.");
 header("Location: $strReturnhtml");
 exit;
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Musikschule Burgart</title>

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>
        <table style="width:766px;height:810px; background:url(IMAGES/bg.jpg) no-repeat" cellspacing="0" cellpadding="0" align="center">
          <tr>
                <td style="height:306px">
                        <img alt="" src="IMAGES/logo.gif" style="margin-left:31px; margin-top:20px"><br>
                        <div style="margin-left:31px; margin-top:20px">
                        <a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r1','','IMAGES/l1.jpg',1)"><img alt="" src="IMAGES/l1.jpg" name="r1"></a><br>
                        <a href="index-1.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r2','','IMAGES/l2-2.jpg',1)"><img alt="" src="IMAGES/l2-2.jpg" name="r2"></a><br>
                        <a href="index-2.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r3','','IMAGES/l3.jpg',1)"><img alt="" src="IMAGES/l3.jpg" name="r3"></a><br>
                        <a href="index-3.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r4','','IMAGES/l5.jpg',1)"><img  alt="" src="IMAGES/l5.jpg" name="r4"></a><br>
                        <a href="index-4.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('r5','','IMAGES/l4.gif',1)"><img  alt="" src="IMAGES/l4.gif" name="r5"></a></div>
                </td>
          </tr>
          <tr>
                <td style="height:380px">
                        <table  cellspacing="0" cellpadding="0">
                          <tr>
                                <td style="height:156px">
                                        <table  cellspacing="0" cellpadding="0">
                                          <tr>
                                                <td style="width:336px;">
                                                        <div  style="margin:1px 25px 0 51px">
                                                                <img alt="" src="IMAGES/5-t1.gif" ><br>
                                                                <br style="line-height:21px">
                                                                <span ><strong>Burgart MUSIK&amp;SCHULE in Scharnebeck</strong></span><br>
Eine weitere Filiale wird am 16.09.2008 in Scharnebeck eröffnet.</div>
                                                        <div class="line" style="margin:22px 0px 0 50px; width:262px"><img alt="" src="IMAGES/spacer.gif" width="1" height="1"></div>
                                                </td>
                                                <td style="width:430px;">
                                                        <div class="line" style="margin:128px 0px 0 198px; width:202px"><img alt="" src="IMAGES/spacer.gif" width="1" height="1"></div>
                                                </td>
                                          </tr>
                                        </table>
                                </td>
                          </tr>
                          <tr>
                                <td style="height:224px">
                                        <table  cellspacing="0" cellpadding="0">
                                          <tr>
                                                <td style="width:472px;">
                                                        <div  style="margin:1px 20px 0 51px">
                                                                <img alt="" src="IMAGES/5-t2.gif" ><br>
                                                                <br style="line-height:32px">
                                                                <span ><strong>Haben Sie Fragen? Dann senden Sie uns eine Nachricht!</strong></span> Wir werden auf jede von Ihnen gestellte Frage schnellst möglich antworten.
                                                        </div>
                                                                                       <form action="<?php print $_SERVER['PHP_SELF']; ?>" method="post">
                                                        <table  cellspacing="0" cellpadding="0">
                                                          <tr>
                                                                <td style="width:250px;">
                                                                        <div class="l_text" style="margin:10px 0px 0 51px">
                                                                        Name:<br>
                                                                        <input type="text" class="input" name="Name"><br>
                                                                        <br style="line-height:2px">
                                                                        E-Mail Addresse:<br>
                                                                        <input type="text" class="input" name="E-Mail"><br>
                                                                        <br style="line-height:2px">
                                                                        Telefon:<br>
                                                                        <input type="text" class="input" name="Telefon"><br>
                                                                        </div>
                                                                </td>
                                                                <td style="width:222px;">
                                                                <br style="line-height:8px">
                                                                        <span class="l_text">Ihre Nachricht:</span>
                                                                        <textarea rows="40" cols="50" name="Bemerkungen"></textarea><br>
                                                                        <input type="submit" value="Senden" />
            <input type="reset" value="Zurücksetzen" />
                                                                </td>
                                                          </tr>
                                                        </table>
                                                        </form>
                                                </td>
                                                <td style="width:36px;">
                                                        <table  cellspacing="0" cellpadding="0">
                                                          <tr>
                                                                <td style="height:44px"></td>
                                                          </tr>
                                                          <tr>
                                                                <td style=" background:url(IMAGES/bg-line.gif) left repeat-y"></td>
                                                          </tr>
                                                          <tr>
                                                                <td style="height:24px"></td>
                                                          </tr>
                                                        </table>
                                                </td>
                                                <td style="width:258px;">
                                                        <img alt="" src="IMAGES/5-t3.gif" style="margin-left:9px; margin-top:2px"><br>
                                                  <img alt="" src="IMAGES/school.jpg" style=" margin-top:26px"><br>
                                                        <br style="line-">
                                                        <span ><strong>21337 Dahlenburger Landstr. 155,<br>
Lüneburg, DE </strong></span><br>
<br style="line-height:5px">
Telefon:&nbsp; &nbsp; 04131/408330<br>
E-mail: <span ><a href="#" >info@burgart-musikschule.de</a></span>                                                </td>
                                          </tr>
                                        </table>
                                </td>
                          </tr>
                        </table>
                </td>
          </tr>
          <tr>
                <td style="height:124px">
                        <table  cellspacing="0" cellpadding="0">
                          <tr>
                                <td style="width:31px;"></td>
                                <td style="width:712px; background:url(images/bg-bot.gif) top repeat-x">
                                        <div class="c_text" style="margin:39px 0px 0 6px">
                                                Copyright 2008 &copy;  All rights reserved. <a href="#" >Terms of use</a>&nbsp; |&nbsp; <a href="index-5.html" >Privacy Policy</a>
                                        </div>
                                </td>
                                <td style="width:23px;"></td>
                          </tr>
                        </table>
                </td>
          </tr>
        </table>
</body>
</html>
mfg Maik
 
Danke AN MAIK UND Maniac_81
Maik's Version des Formular funktioniert, denn er erfüllt die Funktion des EMail-Sendens, aber danach öffnet sich das :

Warning: Cannot modify header information - headers already sent by (output started at /mnt/web4/20/00/51359100/htdocs/burgart-musikschule/index-3.php:1) in /mnt/web4/20/00/51359100/htdocs/burgart-musikschule/index-3.php on line 52

Keine Ahnung was der will :D^^ aber er sendet immerhin ^^
 
Zurück