I've created a page in Wordpress and used this form as template. But when I submit the form it shows Error 404 page not found.
I've tried various scripts in php but I didnt get fruitful results. Hoping for the best answers. Thanks :)
Here is my coding
<?php
/*
template name: visit
*/
$servername= "localhost";
$username="root";
$password="";
$database="wp_chandan"; 
if(isset($_POST['name']) && isset($_POST['email']))
{
    $name=$_POST['name'];
    $email=$_POST['email'];
    var_dump($email);
    @mysql_connect($servername,$username,$password);
    @mysql_select_db($database);
    $query=mysql_query("insert into visitor_d (NAME,Email) values ('$name','$email') ");    
} ?>
<html>
    <head>  
        <?php get_header(); ?>
        <style type='text/css'>
        /* form elements */
        form {
            margin:100px; 
            padding: 10px 2px;
            background: #F5F5F5;  
            width: 50%;
            height:auto;
            border:1px solid green;
        }
        input {
            padding:2px;
            border:1px solid #eee;
            font: normal 1em Verdana, sans-serif;
            color:#777;
            align:center;
        }
        input.button { 
            font: bold 12px Arial, Sans-serif; 
            height: 24px;
            margin: 0;
            align:center;
            padding: 2px 3px; 
            color: #333;
            background: #e7e6e6 url(MarketPlace-images/button.jpg) repeat-x;
            border: 1px solid #dadada;
        }
        </style>
    </head>
    <form action="" method="POST">
        <fieldset>
            <legend><b><u>Visitor Details:</u></b></legend>
            Name: <input type="text" name="name" placeholder="Fill Name" required><br><br>
            Email: <input type="text" name="email" required placeholder="Enter Email"><br><br>
            <input type="submit" name="submit"><br>
        </fieldset>
    </form>
    <?php get_footer();?>
</html>
 
     
     
    