liebewinter: PHP - Class Form gebe keine antwort

Beitrag lesen

Hallo , ersate zu sage das mein deutsch nicht so gut ist …

Ich have zwei dateien , index.php wo wird meine Webformular gezeigt und ClassProveContakt.php , wo meine PHP Code Steht .

Der index.php Code;

<?php



 include 'ClassProveContakt.php';
 header('Content-Type: text/html; Charset=utf-8');
 mb_internal_encoding('UTF-8');
 date_default_timezone_set('Europe/Paris');
 error_reporting(-1);

$ProveContackt=new ClassProveContakt();
?> 


<!DOCTYPE html>
<html lang="en_mx">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>

   <form name="form" id="form" method="post" action="" >

<?php

     $ProveContackt->form();

     $ProveContackt->PostOk();

?>

</form>
</body>
</html>

Der ClassProveContakt.php Code;

<?php

header('Content-Type: text/html; Charset=utf-8');
mb_internal_encoding('UTF-8');
date_default_timezone_set('Europe/Paris');
error_reporting(-1);

class ClassProveContakt {
    private $Name;
    private $Email;
    private $Message;

    function __construct() {
      $this->Name="";
      $this->Email="";
      $this->Message="";
    }

    function Form() {
     echo('<table>');
     echo('<label for="name">Name </label>');
     echo('<input type="text" name="Name" value="'.$this->Name.'">');
     echo('<label for="email"> Email </label>');
     echo('<input type="email" value="'.$this->Email.'" name="Email" ');
     echo('<tr>');
     echo('<td>');
     echo('<br>');
     echo('<label> Message: <br><textarea cols="45" rows="6" name="Message">'.$this->Message.'</textarea></label>');
     echo('<br><br>');
     echo('<input  type="submit" name="post" value="POST COMMENT" id="comment">');
     echo('</td>');
     echo('</tr>');
     echo('</table>');
   }


  function PostOk() {
       
         
      $this->Name=$_POST["Name"];
      $this->Email=$_POST["Email"];
      $this->Message=$_POST["Message"]; 
       
      if(empty($_POST['Name']) || empty($_POST['Email']) || empty($_POST['Message'])) {
        
        


        echo "<br>" . "<b>" . "<h3>*** Please enter all required fields ***</h3>" . "</b>";    

        

      } 

      else 
      {
        
        $file = inclued_get_data("test.txt"); 

        $name = filter_input( INPUT_POST, 'Name', FILTER_SANITIZE_STRING);
        $email = filter_input(INPUT_POST, 'Email', FILTER_SANITIZE_STRING);
        $message = filter_input(INPUT_POST, 'Message', FILTER_SANITIZE_STRING);
        $datetime = date('m/d/Y h:i:s a', time());

       $data = array("name" => $name, "email" => $email, "message" => $message);

        $data = serialize($data);
	    file_put_contents($file, $data . "\n", FILE_APPEND|LOCK_EX);    
       }   
       $messages = file($file);
 
         foreach ($messages as $key => $value) {
		   $data = unserialize($value);
       
              echo "<br>"
                . "<b>From: </b>" . htmlspecialchars( $value->name)
                . "<b> at: </b>" . htmlspecialchars( $value->datetime)
                . "<br><br>" . htmlspecialchars( $value->message)
                . "<br><hr>";
          }   
          

      }

}

 

?>

Das probleme ist die bekome diese warnung :

Fatal error: Uncaught Error: Call to undefined function inclued_get_data() in /var/www/html/ClassProveContakt.php:58 Stack trace: #0 /var/www/html/index4.php(28): ClassProveContakt->PostOk() #1 {main} thrown in /var/www/html/ClassProveContakt.php on line 58

ich bin ganz neue mit php.... , es gibt die möglichkeit mit Json machen was ich möchte , aber ich möchte ohne ihn....

kann Bitte jemand hilfe um diesem probleme zu lösung ? , Danke !

akzeptierte Antworten