Jump to content

Kniggles

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Kniggles

  1. Hi i have been trying to work out why this code will not add the data to the base,

    any pointer please?

    thanks in-advance. :)

    <?php
    
    // Database connection establishment
        $con=mysqli_connect("localhost","Deric","Password,"players");
        
    // Check connection
        if (mysqli_connect_errno($con)) {
            echo "MySQL database connection failed: " . mysqli_connect_error();
        }
    
    //CHECKING SUBMIT BUTTON PRESS or NOT.
    echo "successfull here ";
        if(isset($_POST["submitBtn"]) && $_POST["submitBtn"]!=""){ 
            $name=$_POST["name"];
            $email=$_POST["email"];
            $message=$_POST["message"];
    
    echo "$name";
    echo "$email";
    echo "$message";
    echo "working ** ";
    //INSERT QUERY
        if(mysqli_query("INSERT INTO contact (name, email, message)
            VALUES ($name, $email, $message)")){
            echo "Record inserted successfully";
        }}
    
    
    ?>

     

×
×
  • Create New...