Created
September 27, 2023 16:38
-
-
Save Isabellae4567/112803dfe5883e3c23033cf46f9494ba to your computer and use it in GitHub Desktop.
A simplified code snippet for a contact form that can be used in a WordPress website
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HTML (contact_form.html): | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Contact Us</title> | |
| </head> | |
| <body> | |
| <div class="contact-form"> | |
| <h2>Contact Us</h2> | |
| <form action="process_form.php" method="POST"> | |
| <input type="text" name="name" placeholder="Your Name" required> | |
| <input type="email" name="email" placeholder="Your Email" required> | |
| <textarea name="message" placeholder="Your Message" required></textarea> | |
| <button type="submit">Submit</button> | |
| </form> | |
| </div> | |
| </body> | |
| </html> | |
| CSS (style.css): | |
| /* Add your CSS styles here */ | |
| PHP (process_form.php): | |
| <?php | |
| if ($_SERVER["REQUEST_METHOD"] == "POST") { | |
| $name = $_POST["name"]; | |
| $email = $_POST["email"]; | |
| $message = $_POST["message"]; | |
| // You can add code here to send the email or save the form data to a database. | |
| // For now, let's just display the submitted data. | |
| echo "Name: " . $name . "<br>"; | |
| echo "Email: " . $email . "<br>"; | |
| echo "Message: " . $message; | |
| } | |
| ?> | |
| After creating these files, you can integrate the contact form into your WordPress website by pasting the HTML code into a WordPress page using the "Custom HTML" block. |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have used this snippets code for creation of contact us forum in my website named as Hathorn Corp.