Hi everyone, i've just studied basic PHP and i usually study online. I wite this code for contact form.But i cannot find error and fix it-Because i'm new :-). Please help me. Thank very much

]<?php

/* Subject and Email Variable*/

$emailSubject = 'Email from Clients';
$webMaster = 'tracyn2k2@yahoo.com';

/* Gathering Data Variables */


	$nameField = $_POST['name'];
	$emailField = $_POST['email'];
	$phonenumberField = $_POST['phonenumber'];
	$commentsField = $_POST['comments'];
	
	$body = " From:  $email\r\n  Name:  $name\r\n  Phone number:  $phonenumber\r\n  Comments:  $comments\r\n";
	
	$success = mail($webMaster, $emailSubject, $body);
	
/* Result sender */
	
echo ("
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
	background-color: #000000;
}
.style1 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 0.7em;
	color: #FFFFFF;
	font-weight: bold;
}
a:link {
	text-decoration: none;
	color: #FFFF33;
}
a:visited {
	text-decoration: none;
	color: #FFFF33;
}
a:hover {
	text-decoration: none;
	color: #0066FF;
}
a:active {
	text-decoration: none;
	color: #0099FF;
}
-->
</style></head>

<body>
<div id="content"><img src="images/banner.jpg" align="top">
  <p>&nbsp;</p>
  <p class="style1"><a href="index.html">Back to Homepage </a></p>
  <p class="style1">&nbsp;</p>
  <p class="style1">Dear Clients,</p>
  <p class="style1">Thank you for your inquiries. We will reply you within 24 hours.</p>
  <p class="style1">&nbsp;</p>
  <p class="style1">Best Regards,</p>
  <p class="style1">&nbsp;</p>
  <p class="style1">Fusion CyberWorks. </p>
</div>
</body>
</html>");
?>

Recommended Answers

All 2 Replies

echo ("
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">

the first dquote in the style declaration ends the text in the echo statement, then there is no semicolon, variable, dot, or other structure php understands so there is an error
replace the dquotes in <style type="text/css"> with single quotes or escape them.
and check the rest of the script <p class="style1" .
These would show up (like above) if you had an editor with syntax highlighting, as do unclosed braces <div>without</div> etc
i use a notepad replacement(google) for that reason

Hi almostbob. Thank your helping.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.