Jump to content
Chuks

How to Add PHP code to Bootstrap contact Form

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:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...