Help with PHP Script
Posted: Wed Oct 07, 2009 12:50 pm
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Hi guys
I'm a newbie to php and hopefully some of you experienced guys will be able to spot what I'm doing wrong fairly quick....just please no making fun
.
I'm just working on a simple script to automatically send an email from my contact form to a specific email address. For some reason I can't seem to get the script to work.
The PHP script (PS don't worry about the confirmation page I've just copied in any old html to show it works):
The web page (html markup) is:
http://experiment.treadeverywhere.com/itmb/contact.html
Thanks in advance.
Regards
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Hi guys
I'm a newbie to php and hopefully some of you experienced guys will be able to spot what I'm doing wrong fairly quick....just please no making fun
I'm just working on a simple script to automatically send an email from my contact form to a specific email address. For some reason I can't seem to get the script to work.
The PHP script (PS don't worry about the confirmation page I've just copied in any old html to show it works):
Code: Select all
<?php
/* Subject and Email Variables */
$emailSubject = 'Crazy PHP Scripting!';
$webMaster = 'dazan@treadeverywhere.com';
/*Gathering Data Varialbes */
$forenameField = $_POST['forename'];
$companyField = $_POST['company'];
$positionField = $_POST['position'];
$addressField = $_POST['address'];
$cityField = $_POST['city'];
$potscodeField = $_POST['postcode'];
$telephoneField = $_POST['telephone'];
$emailField = $_POST['email'];
$businessmobilesField = $_POST['businessmobiles'];
$blackberrysolutionsField = $_POST['blackberrysolutions'];
$otherField = $_POST['other'];
$timescaleField = $_POST['timescale'];
$body = <<<EOD
<br><hr><br>
Name: $forename <br>
Company: $company <br>
Postion: $position <br>
Address: $address <br>
City: $city <br>
Postcode: $postcode <br>
Telephone: $telephone <br>
Email: $email <br>
Business Mobiles: $businessmobiles <br>
Blackberry Solutions: $blackberrysolutions <br>
Other: $other <br>
Timescale: $timescale <br>
EOD;
$headers = "From: $email\r\n"
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
/*Results Rendered as html*/
$theResults = <<<EOD
<html>
<head>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="Dazan Alyanai" />
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
<title>Unsupported Browser</title>
<link rel="shortcut icon" HREF="favicon.ICO">
<style type="text/css">
<!--
* {margin: 0; padding: 0}
body {font-size: 62%;
background-color: #666666;
font: 1em Arial, Verdana;
color: #333333;
}
#wrapper {margin: 10em auto;
padding-top: 0em;
position: relative;
padding: 1em;
width: 400px;
height: 200px;
background-color: #999999;
}
-->
</style>
</head>
<body>
<div id="wrapper">
<h1>! Unsupported Browser !</h1>
<br>
<p>This Browser has known compatibility issues with modern web standards.<br><br>We recommend installing or updating to one of the following browsers.</p>
<br>
<a href="http://www.mozilla.com/en-US/products/download.html?product=firefox-3.5.3&os=osx&lang=en-US" style="float: right">Firefox</a><a href="http://www.microsoft.com/windows/internet-explorer/worldwide-sites.aspx">IE 7+</a>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>http://experiment.treadeverywhere.com/itmb/contact.html
Thanks in advance.
Regards
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: