Help with PHP Email Script


Posted on 16th Feb 2014 07:03 pm by admin

Hi guys,

I'm a newbie to php and need help with the script below:

At the moment when I receive the automated email of data, I'm not receiving any information with the form field names I receive blank info and the html markup
eg:

Name:

Company:


and so on.

Also how can I make the from field in the email sent to me display as that of the user who has submitted the form and included his email in the form.

Site: http://experiment.treadeverywhere.com/itmb/contact.html
Script below:



Code: [Select]<?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

<hr>

Name: $forename

Company: $company

Postion: $position

Address: $address

City: $city

Postcode: $postcode

Telephone: $telephone

Email: $email

Business Mobiles: $businessmobiles

Blackberry Solutions: $blackberrysolutions

Other: $other

Timescale: $timescale

EOD;

$success = mail($webMaster, $emailSubject, $body);

/*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>


<p>This Browser has known compatibility issues with modern web standards.

We recommend installing or updating to one of the following browsers.</p>


<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";



?>
Thanks in advance

No comments posted yet

Your Answer:

Login to answer
216 Like 53 Dislike
Previous forums Next forums
Other forums

problems with search form numerical "between" sending by php
I am trying to display the results of a search, on a sql database, on a web page. I set up html &quo

Change Sort Order to Display Newest File First
Hi Guys,

I have a page that sorts the contents (PDFs) of a directory and displays them on the

Running External Scripts
I am very new to PHP and am not even sure what I'm asking is possible. I have just installed mediaW

Multi dimensional arrays
If I put in this code:

1
2
3
4
5
6
7
8
9
10
11
12
13<

insert PHP code into function
Hi,
I'm having problems when trying following:

I have:
Code: [Select]createBar("Do

Help! refer to a friend script with captcha code
Hi guys, I am posting on here in desperate need for some help with an ongoing search I have been doi

Forms Authentication and Refresh at Login page
Hello, When I try to press the Login button in my webapplication at my login.aspx page nothing h

add to sql result
ok see rite now my sites hit counter is counted from the mysql visitor log i need to clear it aft

my two tables
table1 : col1 = topicid , col2 = topic

table2 : col1 = sentid, col2 = sentence

Cod

help connecting a form to php and then emailing the form
Ok. So, I made a form, and I need help to where when submitted, I get an email with the submitted de

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash