Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

How to Create Newsletter SignUp Form Using jQuery and PHP

by
Category:php
php mysql html
How to Create Newsletter SignUp Form Using jQuery and PHP

A newsletter opt-in form using jQuery, PHP and mySQL. An alternative version using html5 for validation is included in this package. See it here. This is a newsletter sign-up for your web site so visitors can subscribe to your newsletter. The visitor is required to enter a name and a valid email. You may also like How to Create Contact form using Ajax, PHP and MySQL and Contact Form Web Application Tutorial Ajax HTML5 PHP

PHP and HTML Code

<?php
    define('DB_SERVER', "localhost");
    define('DB_USER', "root");
    define('DB_PASS', "");
    define('DB_DATABASE', "ieltsmedidb");
    $con = mysqli_connect(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
    
    if(isset($_POST['submit_form']))
    {
        $name=$_POST["user_name"];
        $email=$_POST["email"];

        mysqli_query($con,"insert into news (name,email) values('$name','$email')");
        echo "Thank You For Joining Our Newsletter";
    }
?>

<html>
    <body>
        <h1 class="">Subscribe To Get Email Updates Of Our Latest Tutorials On Web Development</h1>
        <form action="" method="post">
            <p>
                <input type="text" required="" name="user_name" id="user_name" placeholder="Enter Your Name">
                <input type="text" required="" name="email" id="email" placeholder="Enter Your Email Id"/>
            </p>
            <input type="submit" value="Subscribe" name="submit_form"/>
        </form>    
    </body>
</html>

0 Comments


Html code work in comment box


Related Post