Eigene Fehlerseite mit PHP

Du hattest ob_start() und ob_end_flush() nicht an die richtigen Stellen gesetzt.
Wie gesagt, ganz am Anfang und ganz am Ende.
Ausserdem hast Du die ID vor Aufbau der Verbindung zur DB ueberpruefen wollen.
PHP:
<?php
ob_start();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>ATARI CLUB</title>
<style type="text/css">
<!--
p {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#FF0000;}
table {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#FF0000;}
form {
        font-family:Verdana, Arial, Helvetica, sans-serif;
        font-size:12px;
        color:#FF0000;
        border-color:#FF0000;
        border-width: 1px;
        padding: 2px;
}
.Stil2 {
        font-size: 30px;
        font-weight: bold;
        font-family: Arial, Helvetica, sans-serif;
        color: #EF2F3E;}

</style>

<script type="text/javascript">
function click (e) {
  if (!e)
    e = window.event;
  if ((e.type && e.type == "contextmenu") || (e.button && e.button == 2) || (e.which && e.which == 3)) {
    if (window.opera)
      window.alert("Sorry: Diese Funktion ist deaktiviert.");
    return false;
  }
}
if (document.layers)
  document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = click;
document.oncontextmenu = click;
</script>



</head>


<body bgcolor="#FFFFFF" text="#FF0000" scroll="no">



<div style="position: absolute; top: 0px; left: 20px; width:890px; height:500">
<form action="script.php" method="post" name="form1">  
<table border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle" nowrap>
                <center>
        <embed src="atari.avi" width="844" height="282" autostart="true" loop="true" showcontrols="false" /></p>
        </center>
        </td>
  </tr>
  <tr>
    <td align="center" valign="middle" nowrap>&nbsp;</td>
  </tr>
  <tr>
    <td>
         <table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>
                <table border="0" align="left" cellpadding="0" cellspacing="0">
          <tr>
                <td><span class="Stil2">id</span></td>
          </tr>
          <tr>
            <td>
                                <table border="0" align="left" cellpadding="0" cellspacing="5" bgcolor="#EF2F3E">
                                <tr>
                                <td valign="middle">
                                <table height="75" border="0" align="center" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
                                <tr>
                          <td align="left" valign="middle"><input name="id" type="text" style="font-family: Verdana; font-size: 24pt; color: #EF2F3E; border: 0px solid #EF2F3E" tabindex="1" value="" size="3" height="30"></td>
                                </tr>
                                </table>
                                </td>
                                </tr>
                                </table>
                        </td>
                        <td align="left" valign="middle"><img src="spacer.gif" width="25" height="1" hspace="0" vspace="0" border="0"></td>
          </tr>
          <tr>
            <td align="center" valign="middle"><img src="spacer.gif" width="1" height="30" hspace="0" vspace="0" border="0"></td>
                        <td align="left" valign="middle"><img src="spacer.gif" width="25" height="1" hspace="0" vspace="0" border="0"></td>
                  </tr>
          <tr>
            <td><span class="Stil2">m-f</span></td>
          </tr>
                  <tr>
            <td>
                                <table border="0" cellpadding="0" cellspacing="5" bgcolor="#EF2F3E">
                                <tr>
                                <td>
                                <table height="75" border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
                                <tr>
                          <td align="left" valign="middle"><input name="geschlecht" type="text"  style="font-family: Verdana; font-size: 24pt; color: #EF2F3E; border: 0px solid #EF2F3E" tabindex="5" value="" size="3" height="30"></td>
                                </tr>
                                </table>
                                </td>
                                </tr>
                                </table>
                        </td>
                        <td align="left" valign="middle"><img src="spacer.gif" width="25" height="1" hspace="0" vspace="0" border="0"></td>
          </tr>
        </table></td>
        <td align="left" valign="top">
                <table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><span class="Stil2">name</span></td>
          </tr>
          <tr>
            <td>
                                <table border="0" cellpadding="0" cellspacing="5" bgcolor="#EF2F3E">
                                <tr>
                                <td>
                                <table height="75" border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
                                <tr>
                        <td align="left" valign="middle"><input name="name" type=text  style="font-family: Verdana; color: #EF2F3E; font-size: 24pt; border: 0px solid #EF2F3E" tabindex="2" size="10" height="30">                     </td>
                                </tr>
                                </table>
                                </td>
                                </tr>
                                </table>
                        </td>
          <td align="left" valign="middle"><img src="spacer.gif" width="25" height="1" hspace="0" vspace="0" border="0"></td>
          </tr>
          <tr>
            <td align="center" valign="middle"><img src="spacer.gif" width="1" height="30" hspace="0" vspace="0" border="0"></td>
                <td align="left" valign="middle"><img src="spacer.gif" width="25" height="1" hspace="0" vspace="0" border="0"></td>
                  </tr>
          <tr>
            <td><span class="Stil2">mobil</span></td>
          </tr>
                  <tr>
            <td>
                                <table border="0" cellpadding="0" cellspacing="5" bgcolor="#EF2F3E">
                                <tr>
                                <td>
                                <table height="75" border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
                                <tr>
                          <td align="left" valign="middle"><input name="mobil" type=text  style="font-family: Verdana; color: #EF2F3E; font-size: 24pt; border: 0px solid #EF2F3E" tabindex="6" size="10" height="30"></td>
                                </tr>
                                </table>
                                </td>
                                </tr>
                                </table>
                        </td>
                        <td align="left" valign="middle"><img src="spacer.gif" width="25" height="1" hspace="0" vspace="0" border="0"></td>
          </tr>
        </table></td>
        <td align="left" valign="top">
                <table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><span class="Stil2">surname</span></td>
                        <td align="left" valign="middle"><img src="spacer.gif" width="25" height="8" hspace="0" vspace="0" border="0"></td>
                        <td><span class="Stil2">birthday</span></td>
          </tr>
          <tr>
            <td>
                                <table border="0" cellpadding="0" cellspacing="5" bgcolor="#EF2F3E">
                                <tr>
                                <td>
                                <table height="75" border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
                                <tr>
                        <td align="left" valign="middle"><input name="vorname" type="text"  style="font-family: Verdana; font-size: 24pt; color: #EF2F3E; border: 0px solid #EF2F3E" tabindex="3" value="" size="13" height="30">                       </td>
                                </tr>
                                </table>
                                </td>
                                </tr>
                                </table>
                        </td>
                        <td align="left" valign="middle"><img src="spacer.gif" width="25" height="8" hspace="0" vspace="0" border="0"></td>
                        <td>
                                <table border="0" cellpadding="0" cellspacing="5" bgcolor="#EF2F3E">
                                <tr>
                                <td>
                                <table height="75" border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
                                <tr>
                        <td align="left" valign="middle"><input name="geburtsdatum" type=text  style="font-family: Verdana; color: #EF2F3E; font-size: 24pt; border: 0px solid #EF2F3E" tabindex="4" size="10" height="30"4>                            </td>
                                </tr>
                                </table>
                                </td>
                                </tr>
                                </table>
                        </td>
          </tr>
          <tr align="center">
            <td colspan="3" valign="middle"><img src="spacer.gif" width="1" height="30" hspace="0" vspace="0" border="0"></td>
                        </tr>
          <tr>
            <td colspan="3"><span class="Stil2">e-mail</span></td>
                        </tr>
                  <tr>
            <td colspan="3">
                                <table border="0" cellpadding="0" cellspacing="5" bgcolor="#EF2F3E">
                                <tr>
                                <td>
                                <table height="75" border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
                                <tr>
                        <td align="left" valign="middle"><input name="email" type=text  style="font-family: Verdana; color: #EF2F3E; font-size: 24pt; border: 0px solid #EF2F3E" tabindex="7" size="28" height="30"></td>
                                </tr>
                                </table>
                                </td>
                                </tr>
                                </table>
                        </td>
                        </tr>
        </table></td>
      </tr>
    </table>
        </td>
  </tr>
</table>
<p>
<div align="center">
                <input src="atari_button_final.jpg" class="submit" border="0" height="84" type="image" width="212">
</div>
</form>
</div>
<p>&nbsp; </p>

<?php


// $_POST beinhaltet alle eingegebenen Werte des abgeschickten Formulars 
$text1 = $_POST['id'];
$text2 = $_POST['name'];
$text3 = $_POST['vorname'];
$text4 = $_POST['geburtsdatum'];
$text5 = $_POST['geschlecht'];
$text6 = $_POST['mobil'];
$text7 = $_POST['email'];

// Verbindung zur DB aufbauen 
$verbinde=mysql_connect("localhost", "root");
mysql_select_db("messe");
 
$kontakte=mysql_query("select * from kontakte where id='$text1'"); 
if (mysql_num_rows($kontakte)>0) 
{ 
  header("Location:fehler.php"); 
} 


// Query an DB schicken 
mysql_query("INSERT INTO kontakte (id, name, vorname, geburtsdatum, geschlecht, mobil, email, bild) VALUES('$text1','$text2','$text3','$text4','$text5','$text6','$text7','$text1')") or die(mysql_error()); 




?>
</body>
</html>
<?php 
ob_end_flush();
?>
 
So und nun fahr ich erst mal nach Hause von wo das Gewusel dann weiter geht...
Um 17:30 bin ich dann zu Hause... Toll... >_>;
 
Hmm, wenn Du daheim ankommst werd ich mir wahrscheinlich ueberlegen ob ich nicht mal langsam in's Bett geh.
Aber Du kannst ja dann mal den Code den ich grad gepostet hab probieren und dann posten ob's geht.
Entweder bin ich dann noch da oder guck morgen mal wieder rein.
Und Joerg ist ja auch noch da.
 
Ich wusste, das du es nicht verstehst. :D
PHP:
<?php
// $_POST beinhaltet alle eingegebenen Werte des abgeschickten Formulars 
if(isset$_POST['id']) {
$text1 = $_POST['id'];
$text2 = $_POST['name'];
$text3 = $_POST['vorname'];
$text4 = $_POST['geburtsdatum'];
$text5 = $_POST['geschlecht'];
$text6 = $_POST['mobil'];
$text7 = $_POST['email'];


// Verbindung zur DB aufbauen 
$verbinde=mysql_connect("localhost", "root");
mysql_select_db("messe");

$kontakte=mysql_query("select * from kontakte where id='$text1'"); 
if (mysql_num_rows($kontakte)>0) 
{ 
  header("Location:fehler.php"); 
} 


// Query an DB schicken 
mysql_query("INSERT INTO kontakte (id, name, vorname, geburtsdatum, geschlecht, mobil, email, bild) VALUES('$text1','$text2','$text3','$text4','$text5','$text6','$text7','$text1')") or die(mysql_error());
} else {
    echo('Keine ID bekannt');
}
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>ATARI CLUB</title>
<style type="text/css">
<!--
p {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#FF0000;}
table {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#FF0000;}
form {
	font-family:Verdana, Arial, Helvetica, sans-serif;
	font-size:12px;
	color:#FF0000;
	border-color:#FF0000;
	border-width: 1px;
	padding: 2px;
}
.Stil2 {
	font-size: 30px;
	font-weight: bold;
	font-family: Arial, Helvetica, sans-serif;
	color: #EF2F3E;}

</style>

<script type="text/javascript">
function click (e) {
  if (!e)
    e = window.event;
  if ((e.type && e.type == "contextmenu") || (e.button && e.button == 2) || (e.which && e.which == 3)) {
    if (window.opera)
      window.alert("Sorry: Diese Funktion ist deaktiviert.");
    return false;
  }
}
if (document.layers)
  document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = click;
document.oncontextmenu = click;
</script>



</head>


<body bgcolor="#FFFFFF" text="#FF0000" scroll="no">



<div style="position: absolute; top: 0px; left: 20px; width:890px; height:500">
<form action="script.php" method="post" name="form1">  
<table border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle" nowrap>
		<center>
     	<embed src="atari.avi" width="844" height="282" autostart="true" loop="true" showcontrols="false" /></p>
      	</center>
	</td>
  </tr>
  <tr>
    <td align="center" valign="middle" nowrap>&nbsp;</td>
  </tr>
  <tr>
    <td>
	 <table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>
		<table border="0" align="left" cellpadding="0" cellspacing="0">
          <tr>
          	<td><span class="Stil2">id</span></td>
          </tr>
          <tr>
            <td>
				<table border="0" align="left" cellpadding="0" cellspacing="5" bgcolor="#EF2F3E">
 			 	<tr>
   				<td valign="middle">
				<table height="75" border="0" align="center" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
  				<tr>
    			  <td align="left" valign="middle"><input name="id" type="text" style="font-family: Verdana; font-size: 24pt; color: #EF2F3E; border: 0px solid #EF2F3E" tabindex="1" value="" size="3" height="30"></td>
  				</tr>
				</table>
				</td>
  				</tr>
				</table>
			</td>
			<td align="left" valign="middle"><img src="spacer.gif" width="25" height="1" hspace="0" vspace="0" border="0"></td>
          </tr>
          <tr>
            <td align="center" valign="middle"><img src="spacer.gif" width="1" height="30" hspace="0" vspace="0" border="0"></td>
   			<td align="left" valign="middle"><img src="spacer.gif" width="25" height="1" hspace="0" vspace="0" border="0"></td>
		  </tr>
          <tr>
            <td><span class="Stil2">m-f</span></td>
          </tr>
		  <tr>
            <td>
				<table border="0" cellpadding="0" cellspacing="5" bgcolor="#EF2F3E">
 			 	<tr>
   				<td>
				<table height="75" border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
  				<tr>
    			  <td align="left" valign="middle"><input name="geschlecht" type="text"  style="font-family: Verdana; font-size: 24pt; color: #EF2F3E; border: 0px solid #EF2F3E" tabindex="5" value="" size="3" height="30"></td>
  				</tr>
				</table>
				</td>
  				</tr>
				</table>
			</td>
			<td align="left" valign="middle"><img src="spacer.gif" width="25" height="1" hspace="0" vspace="0" border="0"></td>
          </tr>
        </table></td>
        <td align="left" valign="top">
		<table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><span class="Stil2">name</span></td>
          </tr>
          <tr>
            <td>
				<table border="0" cellpadding="0" cellspacing="5" bgcolor="#EF2F3E">
 			 	<tr>
   				<td>
				<table height="75" border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
  				<tr>
    			<td align="left" valign="middle"><input name="name" type=text  style="font-family: Verdana; color: #EF2F3E; font-size: 24pt; border: 0px solid #EF2F3E" tabindex="2" size="10" height="30">    			</td>
				</tr>
				</table>
				</td>
  				</tr>
				</table>
			</td>
     	  <td align="left" valign="middle"><img src="spacer.gif" width="25" height="1" hspace="0" vspace="0" border="0"></td>
          </tr>
          <tr>
            <td align="center" valign="middle"><img src="spacer.gif" width="1" height="30" hspace="0" vspace="0" border="0"></td>
         	<td align="left" valign="middle"><img src="spacer.gif" width="25" height="1" hspace="0" vspace="0" border="0"></td>
		  </tr>
          <tr>
            <td><span class="Stil2">mobil</span></td>
          </tr>
		  <tr>
            <td>
				<table border="0" cellpadding="0" cellspacing="5" bgcolor="#EF2F3E">
 			 	<tr>
   				<td>
				<table height="75" border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
  				<tr>
    			  <td align="left" valign="middle"><input name="mobil" type=text  style="font-family: Verdana; color: #EF2F3E; font-size: 24pt; border: 0px solid #EF2F3E" tabindex="6" size="10" height="30"></td>
  				</tr>
				</table>
				</td>
  				</tr>
				</table>
			</td>
			<td align="left" valign="middle"><img src="spacer.gif" width="25" height="1" hspace="0" vspace="0" border="0"></td>
          </tr>
        </table></td>
        <td align="left" valign="top">
		<table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><span class="Stil2">surname</span></td>
			<td align="left" valign="middle"><img src="spacer.gif" width="25" height="8" hspace="0" vspace="0" border="0"></td>
			<td><span class="Stil2">birthday</span></td>
          </tr>
          <tr>
            <td>
				<table border="0" cellpadding="0" cellspacing="5" bgcolor="#EF2F3E">
 			 	<tr>
   				<td>
				<table height="75" border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
  				<tr>
    			<td align="left" valign="middle"><input name="vorname" type="text"  style="font-family: Verdana; font-size: 24pt; color: #EF2F3E; border: 0px solid #EF2F3E" tabindex="3" value="" size="13" height="30">    			</td>
				</tr>
				</table>
				</td>
  				</tr>
				</table>
			</td>
			<td align="left" valign="middle"><img src="spacer.gif" width="25" height="8" hspace="0" vspace="0" border="0"></td>
			<td>
				<table border="0" cellpadding="0" cellspacing="5" bgcolor="#EF2F3E">
 			 	<tr>
   				<td>
				<table height="75" border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
  				<tr>
    			<td align="left" valign="middle"><input name="geburtsdatum" type=text  style="font-family: Verdana; color: #EF2F3E; font-size: 24pt; border: 0px solid #EF2F3E" tabindex="4" size="10" height="30"4>    			</td>
 				</tr>
				</table>
				</td>
  				</tr>
				</table>
			</td>
          </tr>
          <tr align="center">
            <td colspan="3" valign="middle"><img src="spacer.gif" width="1" height="30" hspace="0" vspace="0" border="0"></td>
			</tr>
          <tr>
            <td colspan="3"><span class="Stil2">e-mail</span></td>
			</tr>
		  <tr>
            <td colspan="3">
				<table border="0" cellpadding="0" cellspacing="5" bgcolor="#EF2F3E">
 			 	<tr>
   				<td>
				<table height="75" border="0" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF">
  				<tr>
    			<td align="left" valign="middle"><input name="email" type=text  style="font-family: Verdana; color: #EF2F3E; font-size: 24pt; border: 0px solid #EF2F3E" tabindex="7" size="28" height="30"></td>
 				</tr>
				</table>
				</td>
  				</tr>
				</table>
			</td>
			</tr>
        </table></td>
      </tr>
    </table>
	</td>
  </tr>
</table>
<p>
<div align="center">
		<input src="atari_button_final.jpg" class="submit" border="0" height="84" type="image" width="212">
</div>
</form>
</div>
<p>&nbsp; </p>
 
Ja du wohnst z.Z in Hong Kong richtig? 6 Stunden Zeitverschiebung oder nicht?
Und ich sitz in Deutschland... super... Ja und ich werd mal nachgucken... Und was meinst du mit ganz oben und unten? bevor die HTML zuende geh oder wie?
.... Ich überprüfs einfach...
 
Richtig, 6 Stunden Zeitverschiebung. :)

Ganz am Anfang und am Ende bedeutet
vor
HTML:
<html>
<body>
und nach
HTML:
</body>
</html>

Weiterhin viel Erfolg.
Eigentlich sollte das Script jetzt so laufen, wenn nicht noch was anderes falsch ist.
Hab nur die Positionen der von mir angemerkten Sachen korrigiert.
 
Wow, ihr wart deutlich schneller :)

@shiro-san: Da bin ich auch schon weg, sorry
@reptiler: Ich fände es (eigentlich) besser die Leute ohne OB programmieren zu lernen.
So kann man ihnen einen sauberen, kompatibleren Stil aneignen und behilft sich nicht immer diesen "Trick"-Methoden.
Ich hatte auch überlegt, ob es hier nicht angebracht wäre, aber wie du siehst, haben wir es hier mit einem schwierigen Pflegekind zu tun. :) *versteck*
 
Tja juhuuu ich muss solange hierbleiben bis es fertig ist... also ran an die Buletten... >_>;
Ich geh wieder ausprobieren.
 
Allgemein kann ich Dir nur Recht geben Joerg, jedoch macht sie das offensichtlich nicht aus Spass oder um es zu lernen, sondern halt weil der Chef es so will.
Daher dachte ich, dass man hier durchaus mal die Quick'n'Dirty-Variante nutzen kann.
Aber es ist schon richtig, dass man nach Moeglichkeit ohne dieses Workaround arbeiten sollte damit man die Output Control fuer andere Spielereien nutzen kann.

@Shiro-san:
'nen netten Chef hast Du. :rolleyes:
 
Zurück