View Single Post
  #1 (permalink)  
Old 07-16-2008, 09:04 PM
Guperman
 
Posts: n/a
Diggs:
Default Form to Mail PHP

Hi there.

I am using the exact PHP script for two web sites, both hosted by the same
company. The company in question claims the same script would not work because
the troubled site's server uses PHP 5.

Could someone please have a look at the script below and tell me where I'm
going wrong.

Or could someone please send me a PHP script for 'name, email and comments'
that could be applied with an HTML confirmation notice.

Thank you very much

<?php

/* subject and email variables */


$subject = 'Comments from website';
$to = 'gustav@stage.co.za';

/* Gathering Data Variables */


$nameField = $_POST['name'];
$commentField = $_POST['comments'];
$emailField = $_POST['email'];

$body = <<<EOD
<br><hr><br>

Name: $name <br>
Email: $email <br>
Comments: $comments <br>

EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
ini_set("sendmail_from", "gustav@gandor.tv");
$success = mail($to, $subject, $body, $headers);



/* Results rendered as HTML */

$theResults = <<<EOD

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Personal Concierge of St. Thomas</title>
<link href="concierge.css" rel="stylesheet" type="text/css" />
<!--[if IE 5]>
<style type="text/css">
/* place css box model fixes for IE 5* in this conditional comment */
#sidebar1 { width: 230px; }
</style>
<![endif]-->
<!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
#sidebar1 { padding-top: 30px; }
#mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to
avoid several bugs */
</style>
<![endif]-->
<style type="text/css">
<!--
-->
</style>
<script src="SpryAssets/SpryEffects.js" type="text/javascript"></script>

<script type="text/javascript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if
((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v9.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3)
with (document) if (getElementById && ((obj=getElementById(args[i]))!=null))
{ v=args[i+2];
if (obj.style) { obj=obj.style;
v=(v=='show')?'visible'v=='hide')?'hidden':v; }
obj.visibility=v; }
}
function MM_effectHighlight(targetElement, duration, startColor, endColor,
restoreColor, toggle)
{
Spry.Effect.DoHighlight(targetElement, {duration: duration, from: startColor,
to: endColor, restoreColor: restoreColor, toggle: toggle});
}
function MM_effectGrowShrink(targetElement, duration, from, to, toggle,
referHeight, growFromCenter)
{
Spry.Effect.DoGrow(targetElement, {duration: duration, from: from, to: to,
toggle: toggle, referHeight: referHeight, growCenter: growFromCenter});
}
//-->
</script>

</head>

<body>



<div id="container">

<div id="sidebar1"><br />
<a href="index.html" onmouseover="MM_effectHighlight(this, 100, '#003366',
'#CCCCCC', '#003366', true)">home</a><br />
<a href="about.html" onmouseover="MM_effectHighlight(this, 100, '#003366',
'#CCCCCC', '#003366', true)">about</a><br />
<a href="Ourservice.html" onmouseover="MM_effectHighlight(this, 100,
'#003366', '#CCCCCC', '#003366', true)">our service</a><br />
<a href="stateSide.html" onmouseover="MM_effectHighlight(this, 100,
'#003366', '#CCCCCC', '#003366', true)">state side</a><br />
<a href="gallery.html" onmouseover="MM_effectHighlight(this, 100, '#003366',
'#CCCCCC', '#003366', true)">picture gallery</a><br />
<a href="contact.html" onmouseover="MM_effectHighlight(this, 100, '#003366',
'#CCCCCC', '#003366', true)">contact us</a></div>

<!-- end #sidebar1 -->
<div id="mainContent"> <span class="heading_18"> &gt;&gt; thank
you</span><br />

<div id="contact_confirmation"><br />
Thank you for making contact with Personal Concierge of St. Thomas.<br />
<br />
We are currently experiencing problems with receiving emails from the
website, so please contact me on 340-690-3542
<br />
<br />
<br />
Yours sincerely<br />
D'Lynn</div>

<br />
<br />

<div id="apSmallPicDlynn"><img src="images/contact_dlynn.jpg" alt=""
width="150" height="99" onload="MM_effectGrowShrink(this, 200, '0%', '100%',
false, false, true)" /></div>


</div>
<!-- This clearing element should immediately follow the #mainContent div in
order to force the #container div to contain all child floats -->

</div>

<div id="footer">website powered by <a
href="http://www.gandor.tv">gandor.tv</a></div>

</body>
</html>

EOD;
echo "$theResults";

?>



Reply With Quote
Sponsored Links