liebewinter: Probleme Data in Date-Bank zu einsetzen

Beitrag lesen

Hallo, Ich habe diese PHP Datei um Form zu Verwalter…

<?php


class ClassProveContakt3 
{

      private $Name;
      private $Email;
      private $Message;
      private $PostOK;
      private $DateTime;
      private $items;
      

 
    function __construct() 
    {

         $this -> ips = $_SERVER['REMOTE_ADDR'];
         $this -> DateTime = date('m/d/Y h:i:s a');  
         $this -> items = ['Name', 'Email', 'Message']; 
          
         $flag = true;
          foreach ( $this -> items as $key ) {  
			           if ( empty ( $_POST[$key] ) )  {
			             $flag = false;    
			           } else {    
			             $this -> $key = trim( filter_var( $_POST[$key], FILTER_SANITIZE_STRING ) );
			            }    
		   }	     
         $this -> PostOk = $flag; 
    }

 
    

  
    function ShowForm() 
    {
?>
      <form  method="POST">
        <label for="name"><b>Name * </b></label>
        <input type="text" id="name" name="Name" value="">
        <label for="email"><b>E-mail * </b></label>
        <input type="email" id="email" name="Email" value="">
        <br><br>
        <label><b> Message * </b><br>
           <textarea cols="45" rows="6" id="text" name="Message"></textarea>      
        </label>
        <br><br>
        <input  type="submit" name="post" value="POST COMMENT" id="comment">
      </form>
<?php
    }
   
  
       
       
      function PostOkT() 
      {

     
              
        

 
               if ($this -> PostOK) 
               {
                 return;
                 
               }     
                   if (empty($this->Name) ||  empty($this->Email) || empty($this->Message))
                   {
                   
                       echo "<br>" . "<b>" . "<h3>*** Please enter all required fields ***</h3>" . "</b>";  
               
                  
                   } 
                   else 
                   {
                   
                       $datetime = date('m/d/Y h:i:s a', time());
                       $data = array("name" => $this->Name, "email" => $this->Email, "message" => $this->Message, "datetime" => $datetime);
                       
    	                 
    			       
                                echo "<br>"

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

                   

       
       }
       function sql()
       {
          

         $datetime = date('m/d/Y h:i:s a', time());
         $data = array("name" => $this->Name, "email" => $this->Email, "message" => $this->Message, "datetime" => $datetime, "ips" => $this->ips );




          $connection = mysql_connect("localhost", "root", "pass"); // Establishing Connection with Server
          $db = mysql_select_db("meine", $connection); // Selecting Database from Server
          if(isset($_POST['submit'])){ // Fetching variables of the form which travels in URL
          $name = $_POST['name'];
          $email = $_POST['email'];
          $message = $_POST['message'];
          $datatime = $DateTime;
          $ips = $ips;


          if($name !=''||$email !=''|| $message !=''){
           //Insert Query of SQL
          $query = mysql_query("insert into mela(name, email, message, datetime, ips) values ('$name', '$email', '$message', '$datatime)");
            echo "<br/><br/><span>Data Inserted successfully...!!</span>";
          }
          else{
            echo "<p>Insertion Failed <br/> Some Fields are Blank....!!</p>";
          }
        }
        mysql_close($connection); // Closing Connection with Server   
      } 

}       
      
            
$Newobject = new ClassProveContakt3();
$Newobject -> ShowForm();
$Newobject ->  PostOkT(); 

?>

und hier my html Code;

<?php
 
 header('Content-Type: text/html; Charset=utf-8');
 mb_internal_encoding('UTF-8');
 date_default_timezone_set('UTC');
 ini_set('display_errors', 1);
 ini_set('display_startup_errors', 1);
 error_reporting(E_ALL);
?> 


<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8"> 
	<title>Computer</title>


<style>
<?php 

 include 'hope_windows.css';
 include 'hope_query.css'; 
   
?>
</style>

<style>
.mellat {

 padding-bottom: 80px;
}

</style>



</head>

<div class="mela"></div>

<body>

<nav id="navs">
   <ul>
    <li><a href="about_us.php">About Us</a></li>
    <li><a href="contact.php">Contact</a></li>
  </ul>
  <ul>
    <li><a href="index.php">Home</a></li>
    <li class="dropdown">
      <a href="#" class="dropbtn">Windows</a>
      <div class="dropdown-content">
       <a href="linux_mint.php">Windows 7</a>
       <a href="ubuntu.php">Windows 8</a>
       <a href="debian.php">Windows 10</a>
       <a href="android.php">Windows 10.2</a>
      </div>
     </li>
     <li class="new-link">
       <a href="#" class="neuen">News & More</a>
       <div class="new-content">
          <a href="#">News</a>
          <a href="#">lerne</a>
        </div>
      </li>
      <li><a href="#">Bücher</a></li>
   </ul>
</nav>



<main  class="mellat">

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. 
</p>
<br>

<p><b id='adderiren'>You comment or question is welcome </b></p>
<br>


<?php
require 'classprove.php';
?>
         
      

</main>

<aside></aside>

<footer id="copry" >
	<p>My Website: Computer and More  © 2019. All Rights Reserved.</p>
<a id="img1" href="https://creativecommons.org/licenses/by-nc-nd/4.0/">
<picture>
  <source media='(max-width: 40em)' srcset='/Photo/Small_by-nc-nd.png'>
  <source media='(max-width: 47.9375em) and (orientation: landscape)' srcset='/Bilder/Small_by-nc-nd.png'>
  <source media='(min-width: 80em)' srcset='/Photo/by-nc-nd.png'>
  <img alt="Creative Commons License" src="/Photo/by-nc-nd.png" style="width:auto;"></a>
</picture>
<p>This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
	Content of this site cannot be republished either online or offline without our permissions. </p>

</footer>


</body>
</html>

wenn füllen auf auf mein comment , er zeigt auf dem Webseite , wie der Screeshot zeigt,

Komment Formular

aber wird nichts geschickt auf meine Datenbank.... Ich arbeite mit Localhost

0 53

Probleme Data in Date-Bank zu einsetzen

liebewinter
  • datenbank
  • php
  1. 1
    Rolf B
    1. 0
      liebewinter
    2. 0
      dedlfix
  2. 0
    pl
    1. 1
      Rolf B
      1. 0
        liebewinter
        1. 0
          Rolf B
          1. 0
            liebewinter
      2. 0
        liebewinter
        1. 0
          Rolf B
          1. 0
            liebewinter
            1. 0
              liebewinter
              1. 0
                liebewinter
                1. 0
                  Rolf B
                  1. 0
                    Wallpappe
                  2. 0
                    dedlfix
                    1. 0
                      Rolf B
                      1. 0
                        dedlfix
                        1. 0
                          Rolf B
                          1. 0
                            liebewinter
                            1. 0
                              Rolf B
                              1. 0
                                liebewinter
                                1. 0
                                  Rolf B
                                  1. 0
                                    liebewinter
                                    1. 0
                                      Rolf B
                                      1. 0
                                        liebewinter
                                        1. 0
                                          Rolf B
                                          1. 0
                                            liebewinter
                                            1. 0
                                              liebewinter
                                            2. 0
                                              Rolf B
                                              1. 0
                                                Tabellenkalk
                                                1. 0
                                                  Rolf B
                                              2. 0
                                                liebewinter
                                              3. 0
                                                liebewinter
                                                1. 0
                                                  Rolf B
                                                  1. 0
                                                    liebewinter
                                                    1. 0
                                                      liebewinter
                                                    2. 0
                                                      Rolf B
                                                      1. 0
                                                        liebewinter
                                                        1. 0
                                                          Rolf B
                                                          1. 0
                                                            liebewinter
                                                            1. 0
                                                              liebewinter
                                                          2. 0
                                                            liebewinter
                                                            1. 0
                                                              liebewinter
                                                              1. 0
                                                                Rolf B
                                                                1. 0
                                                                  liebewinter
                              2. 0
                                liebewinter
                                1. 0
                                  Rolf B
                                  1. 0
                                    Matthias Apsel
                                    1. 0
                                      Rolf B
                  3. 0
                    liebewinter
    2. 0
      pl