nichtschecker: Problme mit Arrays

Beitrag lesen

Hallo,
ich hab en kleines Problem mim Auslesen von Arrays:

eintrag.php: [nicht so wichtig; nur Formular]

<?php
  include("content.php");
?>

<html>
 <head>
  <title><?php echo "$title"; ?></title>
 </head>

<body bgcolor='<?php echo "$bgcolor"; ?>'>
  <form action='eintrag_auswertung.php' method='post'>
  <table width='500' border='0' align='center' style='vertical- align:top;'>
   <tr bgcolor='#CCCCCC'>
    <td width='25%' style='vertical-align:top; text-align:center;'>
     <font style=''>
      <input type='text' name='name' value='Name' size='15' style='border-top: 1px solid; border-right: 1px solid; border-left: 1px solid; border-bottom: 1px solid; border-color: black; background-color: #CCCCCC;'></input>
     </font>
    </td>
    <td width='53%' style='vertical-align:top; text-align:center;'>
     <font style=''>
      <input type='text' name='betreff' value='Betreff' size='35' style='border-top: 1px solid; border-right: 1px solid; border-left: 1px solid; border-bottom: 1px solid; border-color: black; background-color: #CCCCCC;'></input>
     </font>
    </td>
    <td width='22%' style='vertical-align:top; text-align:right;'>
     <font style=''>
      <input type='text' name='datum' value='Datum' size='14' readonly style='border-top: 1px solid; border-right: 1px solid; border-left: 1px solid; border-bottom: 1px solid; border-color: black; background-color: #CCCCCC;'></input>
     </font>
    </td>
   </tr>
   <tr bgcolor='#CCCCCC'>
    <td width='25%' style='vertical-align:top; text-align:center;'>
     <font style=''>
      <input type='text' name='email' value='E-Mail' size='15' style='border-top: 1px solid; border-right: 1px solid; border-left: 1px solid; border-bottom: 1px solid; border-color: black; background-color: #CCCCCC;'></input>
     </font>
     <br>
     <font style=''>
      <input type='text' name='icq' value='Icq' size='15' style='border-top: 1px solid; border-right: 1px solid; border-left: 1px solid; border-bottom: 1px solid; border-color: black; background-color: #CCCCCC;'></input>
     </font>
     <br>
     <font style=''>
      <input type='text' name='homepage' value='Homepage' size='15' style='border-top: 1px solid; border-right: 1px solid; border-left: 1px solid; border-bottom: 1px solid; border-color: black; background-color: #CCCCCC;'></input>
     </font>
    </td>
    <td width='75%' style='vertical-align:top; text-align:left;' colspan='2'>
     <font style=''>
      <textarea name='eintrag' value='' style='border-top: 1px solid; border-right: 1px solid; border-left: 1px solid; border-bottom: 1px solid; border-color: black; background-color: #CCCCCC;' cols='43' rows='7'>Eintrag</textarea>
     </font>
    </td>
   </tr>
  </table>
  <table width='500' border='0' align='center'>
   <tr>
    <td>
     <input type='submit' value='Eintragen'></input>
    </td>
   </tr>
  </table>
  </form>
 </body>
</html>

eintrag_auswertung.php: [wichtig; infos werden in text-datei
                         geschrieben]

<?php
  include("content.php");
?>

<html>
 <head>
  <title><?php echo "$title"; ?></title>
 </head>

<body bgcolor='<?php echo "$bgcolor"; ?>'>
  <?php
    if($name != "" && $betreff != "" && $eintrag != "") {
       $datum = date("d.m.Y");
       $eintrag = str_replace("\r\n", "<br>", $eintrag);
       $fp = fopen("gaestebuch.txt","r");
       $input .= "$name | $betreff | $datum | $email | $icq | $homepage | $eintrag\n";
       while (!feof($fp)) {
          $input .= fgets($fp, 500);
       }
       fclose($fp);
       $fp = fopen("gaestebuch.txt","w+");
       fputs($fp, $input, strlen($input));
       fclose($fp);

echo "<table width='500' border='0' align='center'>
       <tr bgcolor='#CCCCCC'>
        <td width='25%' align='center'>
         <font style='margin-left:5;'>
          <b>Danke für Ihren Eintrag!</b>
         </font>
        </td>
       </tr>
      </table>";
    } else {
       echo "<table width='500' border='0' align='center'>
     <tr bgcolor='#CCCCCC'>
      <td width='25%' align='center'>
       <font style='margin-left:5;'>
        <b>Bitte füllen Sie alle Felder aus!</b>
       </font>
      </td>
     </tr>
    </table>
";
    }
  ?>
 </body>
</html>

guestbook.php [sehr wichtig; arrays werden ausgelesen]

<?php
  include("content.php");
?>

<html>
 <head>
  <title><?php echo "$title"; ?></title>
 </head>

<body bgcolor='<?php echo "$bgcolor"; ?>'>
  <table width='500' border='0' align='center'>
   <tr bgcolor='#CCCCCC'>
    <td align='center'>
     <b>
      <a href='eintrag.php' target='_self'>Ins ins Gästebuch eintragen!</a>
     </b>
    </td>
   </tr>
  </table>

<?php
    $fp = fopen("gaestebuch.txt","r");
    while (!feof($fp)) {
       $zeile = fgets($fp, 500);
       $daten = explode(" | ", $zeile);
       $name = $daten[0];
       $betreff = $daten[1];
       $datum = $daten[2];
       $email = $daten[3];
       $icq = $daten[4];
       $homepage = $daten[5];
       $eintrag = $daten[6];
    }

echo "<table width='500' border='0' align='center'>
   <tr bgcolor='#CCCCCC'>
    <td width='25%'>
     <font style='margin-left:5;'>
      <b>".$name."</b>
     </font>
    </td>
    <td width='75%'>
     <font style='margin-left:5;'>
      <b>".$betreff."</b>
     </font>
     <font style='margin-left:220;'>
      ".$datum."
     </font>
    </td>
   </tr>
   <tr bgcolor='#CCCCCC'>
    <td width='25%' height='*'>
     <font style='margin-left:5;'>
      ".$email."
     </font>
     <br>
     <font style='margin-left:5;'>
      ".$icq."
     </font>
     <br>
     <font style='margin-left:5;'>
      ".$homepage."
     </font>
    </td>
    <td width='75%' style='vertical-align:top;'>
     <font style='margin-left:5; margin-top: 10;'>
      ".$eintrag."
     </font>
    </td>
   </tr>
  </table>
";
  ?>
 </body>
</html>

So... Und nun zum Problem: Wenn man guestbook.php aufruft,
dann wird nichts wiedergegeben!

Siehe http://web540.server37.greatnet.de/tests/gaestebuch/guestbook.php

--
Nichtschecker
webmaster@diemodellwelt.de
http://www.diemodellwelt.de