-1

I have been looking at this for hours it seems like, but I cannot remember how to make it so my HTML and CSS shows up in the PHP output. Am I missing something? I am getting an error code on line 78 or where the code echo ""; starts. Any extra eyes would be appreciated.

<?php
if(isset($_POST['email'])) {

// CHANGE THE TWO LINES BELOW
$email_to = "kavik_609@hotmail.com";

$email_subject = "website html form submissions";


function died($error) {
    // your error code can go here
    echo "We are very sorry, but there were error(s) found with the form you submitted. ";
    echo "These errors appear below.<br /><br />";
    echo $error."<br /><br />";
    echo "Please go back and fix these errors.<br /><br />";
    die();
}

// validation expected data exists
if(!isset($_POST['first_name']) ||
    !isset($_POST['last_name']) ||
    !isset($_POST['email']) ||
    !isset($_POST['telephone']) ||
    !isset($_POST['comments'])) {
    died('We are sorry, but there appears to be a problem with the form you submitted.');       
}

$first_name = $_POST['first_name']; // required
$last_name = $_POST['last_name']; // required
$email_from = $_POST['email']; // required
$telephone = $_POST['telephone']; // not required
$comments = $_POST['comments']; // required

$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$first_name)) {
$error_message .= 'The First Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$last_name)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}
if(strlen($comments) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";

function clean_string($string) {
  $bad = array("content-type","bcc:","to:","cc:","href");
  return str_replace($bad,"",$string);
}

$email_message .= "First Name: ".clean_string($first_name)."\n";
$email_message .= "Last Name: ".clean_string($last_name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Telephone: ".clean_string($telephone)."\n";
$email_message .= "Comments: ".clean_string($comments)."\n";


// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);  


print "<!doctype html>";
print "<html>";
print "<head>";
print "<meta charset="UTF-8">";
print "<title>This & That Unique Designs by Megan Gifford</title>";
print "<meta name="keywords" content="Mecosta County, Big Rapids, Unique, Design, Custom Creations, Florist, Megan Gifford">";
print "<meta name="description" content="This & That: Unique Designs by Megan Gifford">";
print "<link href="thisthat.css" rel="stylesheet" type="text/css">";
print "</head>";

print "<body>";


print "<div id="page">";

print "<img src="images/slideshow/image_7.jpg" width="235" height="992" alt="Second Image" />";




print "<div class="content">";

print "<div class="header">";
print "<img src="logo/header.png" alt="Header">";
print "</div>";






print "<div class="horizontal">";
print "<ul id="nav-bar">";
print "<li class="links"><a href="index.html">Home</a></li>";

print "<li class="links"><a href="#">Events</a>";
print "<ul class="linkshover">";
print "<li class="linkshover"><a href="#">Weddings</a></li>";
print "<li class="linkshover"><a href="#">Funerals</a></li>";
print "<li class="linkshover"><a href="#">Family Gatherings</a></li>";
print "<li class="linkshover"><a href="#">Celebrations</a></li>";
print "<li class="linkshover"><a href="#">Interior Design</a></li>";
print "</ul></li>

print "<li class="links"><a href="#">Gallery</a>";
print "<ul class="linkshover">";
print "<li class="linkshover"><a href="#">Weddings</a></li>";
print "<li class="linkshover"><a href="#">Repurpose Projects</a></li>";
print "<li class="linkshover"><a href="wreaths.html">Custom Wreaths</a></li>";
print "<li class="linkshover"><a href="#">Everyday Flowers</a></li>";
print "<li class="linkshover"><a href="#">Interior Design</a></li>";
print "<li class="linkshover"><a href="#">Head Pieces</a></li>";
print "<li class="linkshover"><a href="#">Odds & Ends</a></li>";
print "</ul></li>";

print "<li class="links"><a href="bloghome.html">Blog</a>";
print "<ul class="linkshover">";
print "<li class="linkshover"><a href="#">Link</a></li>";
print "</ul></li>";

print "<li class="links"><a href="#">Contact</a></li>";

print "</ul>";
print "</div>";

print "<p>Thank you for contacting us. We will be in touch with you very soon.</p>";

print "<div class="footer">";

print "<div id="social">";
print "<a href="https://www.facebook.com/pages/This-That-Unique-Designs-by-Megan-Gifford/978137455546948" target="_blank"><img src="logo/facebook.png" alt="Facebook"></a>";
print "<a href="https://twitter.com/wendyamstar" target="_blank"><img src="logo/pinterest.png" alt="Pinterest"></a>";
print "<a href="http://www.panduvie.com/wendyamstar" target="_blank"><img src="logo/instagram.png" alt="Instagram"></a>";
print "</div>";

print "<img src="logo/footer.png" alt="Footer">";

print "</div>";

print "</div>";


print "</div>";





print "</body>";
print "</html>";
?>

<?php
}
die();
?>

1 Answers1

1

You have problem with " convension .

"" won't allow another " inside it boundary until you escape it

you can use ' inside "" or you can use " inside ' '

or you can escape it like this

print "<meta charset=\"UTF-8\">";
Anik Islam Abhi
  • 25,137
  • 8
  • 58
  • 80