Form to email not working, please help.

Ive made a simple site for some friends who are trying to start a small business and would like some kind of form to email and as far as I can tell the code should be good but its not working. The server is running PHP 5 and everything else works but this.

The Form html

Name: Email: Phone:
Please include the number of cheesecakes, flavors, the address to which you would like them delivered, as well as any special instructions.
Clear Send

and the php code is

<?php $to = "[email protected]" ; $subject = "Cheesecake Order"; $name = $_REQUEST['ordername'] ; $email = $_REQUEST['orderemail'] ; $phone = $_REQUEST['orderphone'] ; $message = $_REQUEST['message'] ; $headers = "From: $email"; $sent = mail($to, $subject, $name, $email, $phone, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?>

can somebody possibly debug this and tell me what im doing wrong?

You issue is your mail() function.
proper mail() function is this…
[php]mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )[/php]

What you need to do is build the email body…
$message = $_REQUEST[‘ordername’] ;
$message .= $_REQUEST[‘orderemail’] ;
$message .= $_REQUEST[‘orderphone’] ;
$message .= $_REQUEST[‘message’] ;
$sent = mail($to, $subject, $message, $headers) ;

Make sense?

Sponsor our Newsletter | Privacy Policy | Terms of Service