Jump to content

How to Add PHP code to Bootstrap contact Form


Chuks

Recommended Posts

Please I am created a bootstrap contact form for my website, and now in the process of validating it before adding  the PHP scripts,but don't figure out how to do it.

Here is the form:<div class="container">
            <div class="col-sm-12">
                <div class="row">
                    <form id="contact-form" method="post" action="welcome2.php" role="form">
                        <div class="form-group has-error has-feedback">
                            <label for="name">Name</label>
                            <input type="text" class="form-control" name="name" required="required"
                             data-error="Name is required">    
                            <div class="help-block with errors"></div>
                        </div><br>
                        <div class="form-group">
                            <label for="email">Email</label>
                            <input type="email" class="form-control" id="email" placeholder="Enter your email*"
                               required="required" data-error="Email is required">
                            <div class="help-block with errors"></div>
                        </div><br>
                        <div class="form-group">
                            <label for="comment">Message</label>
                            <textarea class="form-control" rows="4" required="required"
                                 data-error="Please leave us a message"></textarea>
                        </div>
                        <button type="submit" class="btn btn-default">Submit</button>
                    </form>
                </div>
            </div>    
        </div>

Already I have this php file:

</head>
<body>

Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?><br>
Your message: <?php echo $_POST["message"]; ?><br>

</body>
</html>

Please my problem is how  to display the entries in the input when the user clicks the submit button. On running the code it displays:

Welcome

Your email is:

Your message:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...