Forum Moderators: coopster
I still receive the email ok but it doesn't contain any of the data a visitor has entered.
I spoke to my host today and they have said its probably a coding issue as the old server was php 4 and the new one is php 5.
Truth is, I don't know any php at all... I created this from a free to use script which I hacked around with until it worked properly so haven't a clue how to fix it.
The php file (with text shortened and email address and personal details subbed out) is as follows:
<? mail("$email","Information request","Hello!
Thank you for requesting further information. snipped here ", "From: me@example.com\n");
mail("me@example.com", "Please send me wholesale catalogues", "The following catalogue(s) have just been requested: $cat1$cat2$cat3$cat4
Title: $title
First name: $firstname
Surname: $surname
Company: $companyname
Established: $year
Address 1: $address1
Address 2: $address2
Town: $town
Postcode: $postcode
Telephone: $telephone
Fax: $fax
Email: $email
Comments: $comments", "From: me@example.com\n");
echo"<meta http-equiv='refresh' content='0;URL=http://www.example.com/catalogue-requested.htm'>";
?>
The line of code from the html page that calls this is:
<FORM method="post" action="http://www.example.com/MailingList.php" onsubmit="return formCheck(this);">
Many thanks for any suggestions and apologies if its something blatantly obvious... I guess I should learn php but there never seems enough time!
[edited by: dreamcatcher at 6:43 pm (utc) on May 29, 2009]
[edit reason] use example.com. Thanks. [/edit]
Without seeing the entire form, it's hard to tell what statements you need exactly but i'll guess all the variables in your script come from form elements, so... add this to the top of your script (right after the <? and before the first call to mail()), and give it a go:
$email = $_POST['email'];
$cat1 = $_POST['cat1'];
$cat2 = $_POST['cat2'];
$cat3 = $_POST['cat3'];
$cat4 = $_POST['cat4'];
$title = $_POST['title'];
$firstname = $_POST['firstname'];
$surname = $_POST['surname'];
$companyname = $_POST['companyname'];
$year = $_POST['year'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$town = $_POST['town'];
$postcode = $_POST['postcode'];
$telephone = $_POST['telephone'];
$fax = $_POST['fax'];
$comments = $_POST['comments'];
Hope this helps.
foreach ($_POST AS $key => $value) {
$$key = $value;
}
dc
You can find more information at the website: [php.net...]