'Can I refer to a DIV id or class in a PHP file from a HTML page?
I am trying to add my own custom contact form to a Blogger website project. I've got the contact form HTML code in the Blogger template and its own PHP file running on a server, which link I point to the form tag action. It sends email and both platforms seem to communicate well. Among many improvements I am currently making. My main concern is to learn how to send HTML formatted emails. Everytime a user submits a message, I would like to receive it in HTML format. The CSS below is meant to test this feature which later I will develop.
UPDATE:
<?php
...
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
if ($_POST['Submit']) {
if (empty($_POST['Phone'])) {
$content = "<html>
<head></head>
<body>
<div class='boldtext'>From:</div>
$name
<br/>
<div class='boldtext'>E-mail:</div>
$email
<br/><br/>
$message
<style>
.boldtext {
font-weight: bold;
}
</style>
</body>
</html>";
if (mail ($to, $subject, $content, $from, $headers)) {
echo '<div class="boldtext">Your message has been sent. Thank you!</div>';
} else {
echo '<div class="messageerror">An error has occurred. Try again later.</div>';
}
}
The email client receives the email as plain text instead of HTML formatted though.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
