POST-Methode funktioniert nicht

Alles, was PHP betrifft, kann hier besprochen werden.

POST-Methode funktioniert nicht

Postby trollinger » 27. June 2007 17:21

Bin Anfänger und habe XAMPP 1.6.2 auf Windows XP Home SP2 installiert.
Ich habe folgendes Script zur Eingabe in ein Formularfeld geschrieben (eingabe_post.html), um die Eingabe an ein php-script (ausgabe_post.php) zu übergeben. Mit der GET-Methode funktioniert das einwandfrei, bei POST kommt nichts an.

eingabe_post.html:
Code: Select all
<html>
   <head>
      <meta content='text/html; charset=ISO-8859-1' http-equiv='content-type'>
      <title>Eingabe_post</title>
   </head>
   <body>
      <form enctype='text/plain' method='post' action='ausgabe_post.php' name='frm_eingabe_post' >
          <table >         
          <tr>
              <td>Eingabe:</td>
              <td><input type='text' name='eingabe' size='10' maxlength='15'/></td>
         </tr>
         </table>       
            <p><input value='Abschicken' type='submit'></p>
      </form>
   </body>
</html>


ausgabe_post.php:
Code: Select all
<?php
error_reporting(E_ALL);
header('Cache-Control: no-cache, must-revalidate');
?>
<html>
   <head>
   <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   <title>Ausgabe (post)</title>
   </head>

   <body>
        <?php   
   echo 'die Eingabe war: ';
   echo $_POST['eingabe'];
        ?>
   </body>
</html>


Das Ergebnis sieht so aus:

die Eingabe war:
Notice: Undefined index: eingabe in C:\xampp\htdocs\Versuche\ausgabe_post.php on line 14

Wo liegt mein Fehler?
trollinger
 
Posts: 2
Joined: 27. June 2007 16:51
Location: Weinstadt

Postby Wiedmann » 27. June 2007 17:34

Wo liegt mein Fehler?

Am "enctype".
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby trollinger » 27. June 2007 17:47

Danke für die schnelle Hilfe!
Es funktioniert nun.
trollinger
 
Posts: 2
Joined: 27. June 2007 16:51
Location: Weinstadt


Return to PHP

Who is online

Users browsing this forum: No registered users and 10 guests