Upon clicking on the signup button , the page gets blank and information not stored on the database. The following is my code
<?php
{
echo "Connection failed: " . $e->getMessage();
}
if(isset($_POST['signup'])){
$firstname = $_POST['firstname'];
    if($firstname ==''){
    echo "<script>alert('Please enter your name!')</script>";
    exit();
    }
$query = "insert into users(firstname) VALUES ($firstname) ";
$query = $conn->prepare($query);
$query->bindParam('1', $firstname);
$query->execute();
if($query->rowCount() > 0) {
    echo "<script>window.open('index.php','_self')</script>";
    exit();
}
}
 
     
    
Register a new membership
– karthik morgan Jul 07 '19 at 08:31