liebewinter: PHP - Function wird nicht geschreibt

Beitrag lesen

Hallo , ich habe ein Probleme mit dieser Function die auf meiner ClassProveContakt3.php Datei steht, der Rest von dem Code , funzioniert alles gut... , der Function;

function mella ()
       {
              if(isset($_POST["Name"]) && isset($_POST["Email"]) && isset($_POST["Message"]))
              {
               
              }  
                
                 echo "<table border='1'>";
                 echo "<tr><td><b>Name</b></td><td><b>Email</b></td><td><b>Message</b></td><td><b>datetime</b></td>";
                 echo "</tr>";        
                    
                    
                 $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());
                       
                              
                 $datas = array("name" => $name, "email" => $email, "message" => $message, "datetime" => $datetime);
    	                        
    			     foreach ($datas as $value)              
    			     {
                  echo "<tr><td>$name</td><td>$email</td><td>$message</td><td>$datetime</td>";    			  	 
    			  	   
    			  	    if($datas == $value)
    			       {
    			      	echo"<td>" . htmlspecialchar($value["name"]) . "</td>";
    			      	echo"<td>" . htmlspecialchar($value["email"]) . "</td>";
    			      	echo"<td>" . htmlspecialchar($value["message"]) . "</td>";
    			      	echo"<td>" . htmlspecialchar($value["datetime"]) . "</td>";      
                     echo "</tr>";
      
                   }
                }
                echo "</table>";
               
         }

dieser Function soll auf der Datei me.php speichet werde ;

<?php
include 'ClassProveContakt3.php';

date_default_timezone_set('Europe/Paris');
error_reporting(-1);
error_reporting(E_ALL);

$ProveContackt=new ClassProveContakt3;


?>



<!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="index4.php" >

<?php
    
   
     $ProveContackt->GetPostData();

     $ProveContackt->mella();
    
    

?>

</form>
</body>

</html>   

Das probleme ist das auf der Tabelle nur der Zeit wird gezeigt ,nicht der Name, Email und Message , wie der Screenshot zeigt...

Hier der ganze Code von der ClassProveContakt3.php Datei .

<?php

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


class ClassProveContakt3 
{

      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"> E-mail </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 GetPostData() 
      {
      
          if(isset($_POST["Name"]) && isset($_POST["Email"]) && isset($_POST["Message"]))
           {
                $this->Name = trim(filter_input( INPUT_POST, 'Name', FILTER_SANITIZE_STRING));
                $this->Email = trim(filter_input( INPUT_POST, 'Email', FILTER_SANITIZE_STRING));
                $this->Message = trim(filter_input( INPUT_POST, 'Message', FILTER_SANITIZE_STRING));
           }  
                
       
      } 
  
       
       
      function PostOk() 
      {

     
              
        

 
               if (!isset($_POST['post'])) 
               {
              
                  
                                  
                  return;
               } 
                   if (empty($this->Name) ||  empty($this->Email) || empty($this->Message))
                   {
                   
                       echo "<br>" . "<b>" . "<h3>*** Please enter all required fields ***</h3>" . "</b>";  
               
                  
                   }

          
                   else 
                   {
                   
                   	
                      
                       
                       $file = "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, "datetime" => $datetime);
    	   
    			           $data = serialize($data);
    		              file_put_contents($file, $data . "\n", FILE_APPEND|LOCK_EX);
                       
                       
                       $messages = file($file);
                      
    		              foreach ($messages as $value) {
    		                $data = unserialize($value);
    				                  
        
                                  
                                  echo "<br>"

                                      . "<b>From: </b>" . htmlspecialchars( $data["name"])
                                      . "<b> at: </b>" . htmlspecialchars( $data["datetime"])
                                      . "<br><br>" . htmlspecialchars( $data["email"])                                     
                                      . "<br><br>" . htmlspecialchars( $data["message"])
                                      . "<br><hr>";
        
                       }
               
                    }

       }
       
       
       
       function mella ()
       {
              if(isset($_POST["Name"]) && isset($_POST["Email"]) && isset($_POST["Message"]))
              {
               
              }  
                
                 echo "<table border='1'>";
                 echo "<tr><td><b>Name</b></td><td><b>Email</b></td><td><b>Message</b></td><td><b>datetime</b></td>";
                 echo "</tr>";        
                    
                    
                 $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());
                       
                              
                 $datas = array("name" => $name, "email" => $email, "message" => $message, "datetime" => $datetime);
    	                        
    			     foreach ($datas as $value)              
    			     {
                  echo "<tr><td>$name</td><td>$email</td><td>$message</td><td>$datetime</td>";    			  	 
    			  	   
    			  	    if($datas == $value)
    			       {
    			      	echo"<td>" . htmlspecialchar($value["name"]) . "</td>";
    			      	echo"<td>" . htmlspecialchar($value["email"]) . "</td>";
    			      	echo"<td>" . htmlspecialchar($value["message"]) . "</td>";
    			      	echo"<td>" . htmlspecialchar($value["datetime"]) . "</td>";      
                     echo "</tr>";
      
                   }
                }
                echo "</table>";
               
         }
                
   
}          
                  
            
?>

kann Bitte jemand dieser Probleme zu lösung , danke !