Contact form (Getting page is not working [Local area IP])

I asked for help about 3 days ago on this forum but contact has stalled, I’ve also got test.php to test connection to the database and test query to the database, they work as expected. Is there a typo or am i doing something wrong?
Here is the code so far:

<div class="morecontent_holders">
    <div class="text1">
        <form action="thankyou.php" method="post">
        <input type="text" name="u_name" required><br>

        <input type="email" name="u_email" required><br>

        <input type="text" name="subj" required><br>

        <input type="text" name="message" required><br>
        <input type="submit" value="Submit"><br>

Here is connection.php:

function Connect()
 $dbhost = "localhost";
 $dbuser = "root";
 $dbpass = "";
 $dbname = "responses";
 // Create connection
 $conn = new mysqli(servername, username, password, dbname) or die($conn->connect_erro$
 return $conn;

Here is thankyou.php:

require 'connection.php';
$conn = Connect();

/* skip testing for the POST array for now */

/* Prepare an insert statement */
$query = "INSERT INTO tb_cform (u_name, u_email, subj, message) VALUES (?,?,?,?)";
$stmt = $conn->prepare($query);

$stmt->bind_param("ssss", $_POST['u_name'], $_POST['u_email'], $_POST['subj'], $_POST[$

/* Execute the statement */

if ($stmt->affected_rows > 0) {
  echo "Thank You For Contacting Us <br>";
  printf("rows inserted: %d\n", $stmt->affected_rows);
} else {
  echo "Did not enter data";

/* close statement */


Any help would be gratefully appreciated thank you :slight_smile:

A post was merged into an existing topic: Need help in submitting a contact form to a phpmyadmin database