Form advice?

Hello all I have worked up this php from from diff samples off the internet.
Not sure about one of the functions. could I please get some advice?

<form name="dp01" method="post" action="sendDropBox.php">
<fieldset>

	<input name="title" type="text" class="generic">
	<legend>what type of box would you like?</legend>
	<input name="subject" type="text" id="subject" size="50">

	<legend>Details and information</legend>
	<textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>

	<legend>Your Name</legend>
	<input name="name" type="text" id="name" size="50">
	<p>&nbsp;</p>
	<legend>Your Email</legend>
	<input name="customer_mail" type="text" id="customer_mail" size="50"></td>
	<p>&nbsp;</p>
	<input type="submit" name="Submit" value="Submit">
	<input type="reset" name="Submit2" value="Reset">

</fieldset>
</form>
<?php

// Contact subject
$subject ="$subject";

// Details
$message="$detail";

// Mail of sender
$mail_from="$customer_mail";

// From
$header="from: $name <$mail_from>";

// Enter your email address
$to ='theEmail@gmail.com';
$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email
// We've received your request and will soon be in touch."
if($send_contact){
	if(isset($_POST['subject'],$_POST['detail'], $_POST['name'], $_POST['customer_mail'])){
		if(isset($_POST['title']) && !empty($_POST['title'])){
		die();
		}
		echo "We've received your request and will soon be in touch.";
	}else {
	echo "ERROR";
	}
}

?>

my thing is this…I do not see how the submit button is connected to the action of

$send_contact

I also tried to add the

isset

component but was then wondering if I added correctly the

if($send_contact)

at the top.
& the .generic is to create a hidden input field as an added bot prevention.
Thank you
dlm

You need to set those variables.

<?php
if(isset($_POST['Submit'])){
	// Contact name
	$name = (isset($_POST['name']) && !empty($_POST['name']) ? trim($_POST['name']) : '');	
	// Contact subject
	$subject = (isset($_POST['subject']) && !empty($_POST['subject']) ? trim($_POST['subject']) : '');	
	// Details
	$message = (isset($_POST['detail']) && !empty($_POST['detail']) ? trim($_POST['detail']) : '');	
	// Mail of sender
	$mail_from = (isset($_POST['customer_mail']) && !empty($_POST['customer_mail']) ? trim($_POST['customer_mail']) : ''); 
	
	if(!empty($name) && !empty($subject) && !empty($message) && !empty($mail_from)){
		// KILL field
		if(isset($_POST['title']) && !empty($_POST['title'])){
			die();
		} 
		
		// From 
		$header="from: $name <$mail_from>";
		
		// Enter your email address
		$to ='theEmail@gmail.com';
		if(mail($to,$subject,$message,$header)){
		   echo "We've received your request and will soon be in touch.";
		}else{
		    echo "ERROR";
		}
	}else{
		   echo "All fields required";
	} 
}
?>

Thank you for your help will go & try it out
D

yep. still having probs. wonder if it is because it is in wordpress…but that should not affect it.
Thank you though.
D

title input should probably be hidden, other than that, I think it should be good. What do you mean by having problems?

<input name="title" type="hidden" class="generic">

You probably need to setup an email account at you host and set this as the From: address and have reply-to as the senders address

		//Website email
		$from "email@website.com";
		// From		
		$header = "From: $name <$from>\\r\
";
		$header .= "Reply-To: $mail_from\\r\
";

Thank you Drummin will try it. as is for now i gave up & grabbed the plug in Easy Contact Forms, as i get more time i’ll come back to this and do my own.
Thanks again
D