BOOTSTRAP TEMPLATE CONTACT FORM
BideAugustin
Posted messages
24
Status
Member
-
BideAugustin Posted messages 24 Status Member -
BideAugustin Posted messages 24 Status Member -
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:
Here is the linked "contact.php" file:
Please help me. Thank you very much in advance.
Configuration: Windows / Chrome 92.0.4515.159
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
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
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
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?
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?
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.
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.
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.