Complete noob - please help!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
olicorse
Forum Newbie
Posts: 2
Joined: Sun Nov 23, 2008 11:01 am

Complete noob - please help!

Post by olicorse »

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');

?>
Citrate
Forum Newbie
Posts: 5
Joined: Sat Nov 22, 2008 3:26 pm

Re: Complete noob - please help!

Post by Citrate »

Can you include the html for the form?
Post Reply