Hi,
I've literally just started learning PHP this weekend... I've made a simple mail form for a website but for some reason when the fields are filled out, the email it sends swaps the "email" field with the "phone" field.
I've looked over and over and i'm 100% sure that text boxes it is posting the info from are called the correct names. Could someone take a look at the code and tell me if you can see what i'm doing wrong? It's driving me crazy and it's literally the final thing I need to sort out before the site is ready!
Also, I copied the first bit from another forum because I was getting backslashes whenever I typed apostrophes or speech marks. Might that have made a difference? I've tried deleting the top bit of code and re-uploading it but it still shows the Email/Phone info the wrong way round.
Thanks in advance!
<?php
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value)
{
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
$name = $_POST['name'];
$subject = $_POST['subject'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$text = $_POST['text'];
$enquiry = "Name: " . $name ;
$enquiry .= "\n\nPhone: " . $telephone;
$enquiry .= "\n\nEnquiry: " .$text;
mail('oli@hotmail.com', $subject, $enquiry, 'From:' . $name . ' <' . $email . '>');
header('Location:contactthanks.html');
?>
Complete noob - please help!
Moderator: General Moderators
Re: Complete noob - please help!
Can you include the html for the form?