BOOTSTRAP TEMPLATE CONTACT FORM

Hello.

Please, I have a Bootstrap template and I would like to link the "contact" file they provided to my HTML form so that it becomes functional with my professional email.

Here is the form:

 <div class="col-lg-6"> <form action="forms/contact.php" method="post" role="form" class="php-email-form"> <div class="row"> <div class="col form-group"> <input type="text" name="name" class="form-control" id="name" placeholder="Your Name" required> </div> <div class="col form-group"> <input type="email" class="form-control" name="email" id="email" placeholder="Your Email" required> </div> </div> <div class="form-group"> <input type="text" class="form-control" name="subject" id="subject" placeholder="Subject" required> </div> <div class="form-group"> <textarea class="form-control" name="message" rows="5" placeholder="Message" required></textarea> </div> <div class="my-3"> <div class="loading">Loading</div> <div class="error-message"></div> <div class="sent-message">Your message has been sent successfully. Thank you!</div> </div> <div class="text-center"><button type="submit">Send</button></div> </form> </div>


Here is the linked "contact.php" file:

<?php // Replace contact@example.com with your real receiving email address $receiving_email_address = 'contact@example.com'; if( file_exists($php_email_form = '../assets/vendor/php-email-form/php-email-form.php' )) { include( $php_email_form ); } else { die( 'Unable to load the "PHP Email Form" Library!'); } $contact = new PHP_Email_Form; $contact->ajax = true; $contact->to = $receiving_email_address; $contact->from_name = $_POST['name']; $contact->from_email = $_POST['email']; $contact->subject = $_POST['subject']; // Uncomment below code if you want to use SMTP to send emails. You need to enter your correct SMTP credentials /* $contact->smtp = array( 'host' => 'example.com', 'username' => 'example', 'password' => 'pass', 'port' => '587' ); */ $contact->add_message( $_POST['name'], 'From'); $contact->add_message( $_POST['email'], 'Email'); $contact->add_message( $_POST['message'], 'Message', 10); echo $contact->send(); ?> 


Please help me. Thank you very much in advance.

Configuration: Windows / Chrome 92.0.4515.159

8 answers

  1. Moderator
    Hello
    Are you working locally on your computer or on a server?
    What’s the exact issue?
    What does the PHP_Email_Form class contain?

    --
    Best regards,
    Jordane
    0
    1. I'm currently working locally. But I'm planning to deploy on a server.
      The problem is that I would like to make the contact form functional so that a visitor can send me an email. In reality, it's a free Bootstrap template that I'm modifying for my needs.

      The class "PHP_Email_Form" only contains Bootstrap styles.

      I would like to know what to include in the PHP code so that when I subscribe to a server, it works. Or should I subscribe first?
      0
      1. Moderator
        The class "PHP_Email_Form" only contains bootstrap styles

        Given the code, I doubt it...

        In any case, what software do you use to emulate the server on your computer?
        And what exact issue are you encountering?
        0
    2. Thank you for the responses. My concern, as I mentioned earlier, is to be able to adapt the PHP code so that it can create an email contact system on my site (I'm not good at PHP, please). I'm using WAMP as a local server.
      0
      1. Moderator
        It's not a problem... But the goal of what you want to accomplish...
        The issue... is the possible error message, the unexpected behavior of the code... a bug, basically...
        So... explain to us the problem encountered.
        0
    3. In reality, I haven't executed the code as I don't have the Bootstrap PHP library. So my "BIG" problem is finding a complete PHP code that allows me to make my contact form work, that's all my brother. Because I don't know much about PHP. Thank you for your understanding.
      0
      1. Moderator
        Bootstrap is not a PHP library
        It's a CSS framework... That you can download easily from the Internet.
        0
    4. Yes, of course, and here I am asking for your help to make my contact page work.
      0
      1. Moderator
        And what doesn't work on your page?
        Clearly, you haven't tested it, so you don't know anything about it.... And neither do we....
        Especially since you're using a PHP class that we know nothing about....
        No matter how skilled we are, we're not clairvoyants yet.
        0
      2. @jordane45Could I have a piece of code that allows me to solve my problem just by replacing (in the code) my email address???

        Thank you in advance!!
        0
    5. You want to know what the PHP class contains, right?
      0
      1. Hello,

        It seems that the missing class in the code is a paid option for templates made with Bootstrap.

        For a free alternative, check out the PHPMailer class: https://github.com/PHPMailer/PHPMailer
        You'll find plenty of tutorials online that explain how to use this class to replace the code in your contact.php file.
        0
        1. Hello my brother.

          Thank you very much, that's what I wanted.

          Have a good day.
          0