Hello. I'm in the middle of updating a site for work and I'm stuck at the moment, so I was wondering could anyone help me out if possible. I'm new to PHP and HTML, been using them for nearly 2 weeks.

What I'm doing is that there is 5 forms for the user to select, any one can be selected. Once the user fills in the form and submits the form I would like the Admin (a email address) to get a email, and in that email I would like to display the form that the user has filled out. So say for example the form has:

Document Title - ABC123
Document Number - 12345
Document Name - Annual Report
Author Name - Joe Bloggs

The user fills it in and once submit is hit the admin gets an email that contains the exact information above. Could anyone point me in the right direction? I've Googled the problem but I can only find how to display an email form, not submit a page and recieve data in an email filled out the way it was submitted

I only have a small bit of code but it doesn't work and I'm unsure of how to go about doing this so if anyone could help me I'd appreciate it alot.

Recommended Answers

All 28 Replies

For code on emailing you can search this forum. A lot of examples can be found. If you are having specific problems, post the relevant code, and your question.

For code on emailing you can search this forum. A lot of examples can be found. If you are having specific problems, post the relevant code, and your question.

Yeah I have been searching. The reason I didn't post the code is that I'm not fully sure how to go about coding it. I can do it so it is like a email form you would leave on a web page such as a contact page EG. name email address and it submits a email that way. But it's not how I want to do it, I want to fill in a form in on a site, press submit and that form is sent to the admin. Would you suggest something like Pear to do the email?

try there to put your code may be helpful for you

My code is just naming my variables like -

$doc_title  = $_POST["doc_title"];
$doc_number = $_POST["doc_number"];

Can anyone help me please? I'm unsure of what to do or how to go about implementing what I want.

Check here.

Just a brief synopsis and then you can look at the link in Zero13's post for more details on PHP's mail function.

One one page you have your form and then the page that the first one submits to should have something like the following:

<?php
$email_to = "you@yourdomain.com";
$name = $_POST['name'];
$return_email = $_POST['return_email'];
$message = $_POST['message'];
?>

You can name the variables whatever you want that will make sense to you. Just make sure that the name in the $_POST portion of each line matches the name that you give to the textfield/textarea (any form input you offer) in the form or else the second page cannot capture the value sent from that input for use. And for this you should specify method=POST in your opening form tag.

Then you can use the MAIL function to format the email. You'd want to send it to $email_to, set the FROM to be $return_email (as this is the address you'd be sending your reply to if you respond to the email this script sends as it should be the user's e-mail address and then you can format $message which is the text entered into the text area and set it as the body of the e-mail that the form sends.

Now, this method will send e-mails to ONLY one e-mail address which is specified between the double quotes of $email_to. But if there are multiple people of whom ONE should be sent the message you can do a drop down box like so:

<select name="email_to">
<option value="jon_doe@domain.com">Jon Doe - CEO</option>
<option value="jane_dough@domain.com">Jane Dough - HR Manager</option>
<option value="wildman@likestoparty.com">James Doh - Regional Manager</a>

Then the one line in the code above would change to:

$email_to = $_POST['email_to'];

In the select (drop down menu) code it doesn't matter what text you put between the option tags as it is only what is displayed in the drop down menu displayed on the site. For demo purposes I included names and their position which may help a user decide which person to send it to. By selecting the person on the form it sends the e-mail address where the email should be sent.

And again, once you have the form how you want and you properly capture the data from the form use the MAIL function to send the data by e-mail.

It would also be a good idea to use PHP to make check for a couple of things:

1. That none of the fields are left blank. If any fields are left blank it should not send the e-mail and print out an error message stating that the fields need to be filled out.

2. Look up a regular expression that checks for the validity of an e-mail address which will basically check to make sure that the e-mail address that they enter where they want your response to be sent is a properly formatted e-mail address. If they entered "me@mydomain" then the regular expression should fail because that is not a proper domain (the expression would check that there is a .net, .com, .org, etc after the domain name. Someone may not purposefully put an incorrect e-mail address...especially if they WANT to get a response from you. But they could accidentally leave some of the address off or submit the form before they were ready.

It will not check that the e-mail address is actually in existence but it's about as close as it gets.

Best of luck.

Just a brief synopsis and then you can look at the link in Zero13's post for more details on PHP's mail function.

One one page you have your form and then the page that the first one submits to should have something like the following:

<?php
$email_to = "you@yourdomain.com";
$name = $_POST['name'];
$return_email = $_POST['return_email'];
$message = $_POST['message'];
?>

You can name the variables whatever you want that will make sense to you. Just make sure that the name in the $_POST portion of each line matches the name that you give to the textfield/textarea (any form input you offer) in the form or else the second page cannot capture the value sent from that input for use. And for this you should specify method=POST in your opening form tag.

Then you can use the MAIL function to format the email. You'd want to send it to $email_to, set the FROM to be $return_email (as this is the address you'd be sending your reply to if you respond to the email this script sends as it should be the user's e-mail address and then you can format $message which is the text entered into the text area and set it as the body of the e-mail that the form sends.

Now, this method will send e-mails to ONLY one e-mail address which is specified between the double quotes of $email_to. But if there are multiple people of whom ONE should be sent the message you can do a drop down box like so:

<select name="email_to">
<option value="jon_doe@domain.com">Jon Doe - CEO</option>
<option value="jane_dough@domain.com">Jane Dough - HR Manager</option>
<option value="wildman@likestoparty.com">James Doh - Regional Manager</a>

Then the one line in the code above would change to:

$email_to = $_POST['email_to'];

In the select (drop down menu) code it doesn't matter what text you put between the option tags as it is only what is displayed in the drop down menu displayed on the site. For demo purposes I included names and their position which may help a user decide which person to send it to. By selecting the person on the form it sends the e-mail address where the email should be sent.

And again, once you have the form how you want and you properly capture the data from the form use the MAIL function to send the data by e-mail.

It would also be a good idea to use PHP to make check for a couple of things:

1. That none of the fields are left blank. If any fields are left blank it should not send the e-mail and print out an error message stating that the fields need to be filled out.

2. Look up a regular expression that checks for the validity of an e-mail address which will basically check to make sure that the e-mail address that they enter where they want your response to be sent is a properly formatted e-mail address. If they entered "me@mydomain" then the regular expression should fail because that is not a proper domain (the expression would check that there is a .net, .com, .org, etc after the domain name. Someone may not purposefully put an incorrect e-mail address...especially if they WANT to get a response from you. But they could accidentally leave some of the address off or submit the form before they were ready.

It will not check that the e-mail address is actually in existence but it's about as close as it gets.

Best of luck.

Thanks a million for the reply, very grateful. I'll try this out now and let you know how I get on, thanks again :)

Hi guys so far I have this -

<?php

$email_to = "dave-f-06@hotmail.com";
$return_email = $_POST['abc123@hotmail.com'];

$doc_title			= $_POST["doc_title"];
$doc_number			= $_POST["doc_number"];
$doc_type			= $_POST["doc_type"];
$revision			= $_POST["revision"];
$cdm_link			= $_POST["cdm_link"];
$mars_link 			= $_POST["mars_link"];
$checklist_link		        = $_POST["checklist_link"];
$link_internal_1_3	        = $_POST["link_internal_1_3"];
$impacted_products	        = $_POST["impacted_products"];
$abstract 			= $_POST["abstract"];
$scope 				= $_POST["scope"];
$impacted_products 	        = $_POST["impacted_products"];
$type_review		        = $_POST["type_review"];
$full_simplified	        = $_POST["full_simplified"];
$pref_earliest		        = $_POST["pref_earliest"];
$pref_latest		        = $_POST["pref_latest"];
$proj_name			= $_POST["proj_name"];
$auth_name 			= $_POST["auth_name"];
$req_list			= $_POST["req_list"];
$chairperson		        = $_POST["chairperson"];
$req_reviewers 		        = $_POST["req_reviewers"];
$review_duration	        = $_POST["review_duration"];
$document_abstract	        = $_POST["document_abstract"];

?>

I was looking at the link Zero sent but I cant really figure out how to get it working to suit what I need it for. See for example in this section of code taken from the link Zero showed -

<?php
// The message
$message = "Line 1\nLine 2\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('caffeinated@example.com', 'My Subject', $message);
?>

In that code it has a $message section, but, what I'm confused about is that I'm not sending a message or that, I'm just sending information that is filled into certain text fields, ie I dont want the user to have to input the email they want to send it to.

So like in the first section of code I posted, the user fills in a document title, document number etc then they click submit. What I want to happen then is that on the Submit click, an email is sent to someone@hotmail.com. And in that email it contains the document title, document number etc and the information that the user put into each of them fields.

I don't no if I am explaining it wrong or what? Or does anyone understand what I'm looking for?

Here's the main code for mailing a form i just cut out of a function of mine

<?php
if($_POST['submit'] == 'TRUE'){
	$postdata = array();
	$msg = "<h1>Form Filled in at ".date("Y-m-d H-i-s")."</h1>\r\n";
	$msg .= "<table>\r\n";
	$msg .= "<tr><td>Field</td><td>Value</td></tr>\r\n";
	foreach($_POST as $k=>$v){//delete the space inbetween & #39; and & #34;
		$v = str_replace('"', '& #34;', $v);$v = str_replace("'", '& #39;', $v);$v = str_replace('\\', '/', $v);
		$k = str_replace('"', '', $k);$k = str_replace("'", '', $k);$k = str_replace('\\', '', $k);
		$msg .= "<tr><td>{$k}</td><td>{$v}</td></tr>\r\n";
		$postdata[$k] = $v;
	}
	$msg .= "</table>\r\n";
	
	$to = 'email@example.com';
	$from = 'mail@example.com';
	$subject = 'Form Filled in';
	$headers = "MIME-Version: 1.0\r\n"; 
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .= 'From: '.$postdata['firstname'].' '.$postdata['surname'].' <'.$from.'>' . "\r\n";
	$D = array();
	if(mail($to,$subject,$msg,$headers)){
		$D['result'] = 'Your form has been sent successfully, we will get back to you as soon as possible';
		$D['sent'] = true;
	}else{
		$D['result'] = 'Sorry the form failed to send, please retry sending or just call us instead!';
		$D['sent'] = false;
	}
}else{
	$D['result'] = '';//page just opened, no message unless you want one
	$D['sent'] = false;
}

if($D['sent']){
	//if you want redirect on success
	//header("Location: http://www.example.com/thankyou.php");
}
?>
<span class='responsemsg'><?php if($D['result'] != ''){echo $D['result'];}?></span>
<form method='post'>
<input type='hidden' name='formname' value='form1'/>
<input name='firstname' value='<?php if(isset($postdata['firstname'])){echo $postdata['firstname'];}?>'/>
<input name='surname' value='<?php if(isset($postdata['surname'])){echo $postdata['surname'];}?>'/>
<input type='submit' name='submit' value='TRUE'/>
</form>

I did an example of how to write the input fields so on error they autofill with what was previously typed, you just need to change:
$to
$from
$subject
and the styling of the form.

From experience i would set $from to the default mail account on your hosting server, not the email the user types in

Thanks for the above ^ I'm just after finishing what I've been doing and it doesnt work - Why I'm not sure but it doesnt. Here is what I have, the code is very long so I'm sorry about that.

When I click submit I don't get any errors but I don't receive any email either so I'm not sure..?? :(

<?php
/// ---------------------------------
/// Including the database connection
/// ---------------------------------

include 'connect_db.php';

/// ----------------------------------------
/// If the form fails, print out error below
/// ----------------------------------------

if(isset($_POST['email'])) 
{
	$email_to = "dave-f-06@hotmail.com";
	$email_subject = "TC Review Requested";
	
	function died($error)
	{
	// Error code here
		echo "Sorry but there has been an error found with the form you submitted. ";
		echo "The errors are below.<br /><br />";
		echo $error."<br /><br />";
		echo "Please retry filling in the form.<br /><br />";
		die();
	}
	
	// Validation
	if(!isset($_POST['doc_title'])		 	||
		!isset($_POST['doc_number'])	 	||
		!isset($_POST['doc_type'])   	 	||
		!isset($_POST['revision'])  	 	||
		!isset($_POST['cdm_link'])  	 	||
		!isset($_POST['mars_link']) 	 	||
		!isset($_POST['checklist_link']) 	||
		!isset($_POST['link_internal_1_3'])     ||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['abstract'])		||
		!isset($_POST['scope'])			||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['type_review'])		||
		!isset($_POST['full_simplified'])	||
		!isset($_POST['pref_earliest'])		||
		!isset($_POST['pref_latest'])		||
		!isset($_POST['proj_name'])		||
		!isset($_POST['auth_name'])		||
		!isset($_POST['req_list'])		||
		!isset($_POST['chairperson'])		||
		!isset($_POST['req_reviewers'])		||
		!isset($_POST['review_duration'])	||
		!isset($_POST['document_abstract']))
		{
			died('There appears to be a problem with the form you submitted.');
		}
	
	$doc_title			= $_POST["doc_title"];			// Required
	$doc_number			= $_POST["doc_number"];			// Required
	$doc_type			= $_POST["doc_type"];			// Required
	$revision			= $_POST["revision"];			// Required
	$cdm_link			= $_POST["cdm_link"];			// Required
	$mars_link 			= $_POST["mars_link"];			// Required
	$checklist_link		= $_POST["checklist_link"];		// Required
	$link_internal_1_3	= $_POST["link_internal_1_3"];	// Required
	$impacted_products	= $_POST["impacted_products"];	// Required
	$abstract 			= $_POST["abstract"];			// Required
	$scope 				= $_POST["scope"];				// Required
	$impacted_products 	= $_POST["impacted_products"];	// Required
	$type_review		= $_POST["type_review"];		// Required
	$full_simplified	= $_POST["full_simplified"];	// Required
	$pref_earliest		= $_POST["pref_earliest"];		// Required
	$pref_latest		= $_POST["pref_latest"];		// Required
	$proj_name			= $_POST["proj_name"];			// Required
	$auth_name 			= $_POST["auth_name"];			// Required
	$req_list			= $_POST["req_list"];			// Required
	$chairperson		= $_POST["chairperson"];		// Required
	$req_reviewers 		= $_POST["req_reviewers"];		// Required
	$review_duration	= $_POST["review_duration"];	// Required
	$document_abstract	= $_POST["document_abstract"];	// Required

	function clean_string($string)
	{	
		$bad = array("content-type", "bcc:", "to:", "cc:", "href");
		return str_replace($bad,"",$string);
	}
	
	$email_message .= "Document Title: ".clean_string($doc_title)."\n";
	$email_message .= "Document Number: ".clean_string($doc_number)."\n";
	$email_message .= "Document Type: ".clean_string($doc_type)."\n";
	$email_message .= "Revision: ".clean_string($revision)."\n";
	$email_message .= "CDM Link: ".clean_string($cdm_link)."\n";
	$email_message .= "Mars Link: ".clean_string($mars_link)."\n";
	$email_message .= "Checklist Link: ".clean_string($checklist_link)."\n";
	$email_message .= "Link to 1/3 /Internal Review: ".clean_string($link_internal_1_3)."\n";
	$email_message .= "Impacted Products: ".clean_string($impacted_products)."\n";
	$email_message .= "Abstract: ".clean_string($abstract)."\n";
	$email_message .= "Scope: ".clean_string($abstract)."\n";
	$email_message .= "Impacted Products: ".clean_string($impacted_products)."\n";
	$email_message .= "Type of Review: ".clean_string($type_review)."\n";
	$email_message .= "Full or Simplified: ".clean_string($full_simplified)."\n";
	$email_message .= "Preferred Earliest Review Dates: ".clean_string($pref_earliest)."\n";
	$email_message .= "Preferred Latest Review Dates: ".clean_string($pref_latest)."\n";
	$email_message .= "Project Name: ".clean_string($proj_name)."\n";
	$email_message .= "Author Name: ".clean_string($auth_name)."\n";
	$email_message .= "List of Required Attendees: ".clean_string($req_reviewers)."\n";
	$email_message .= "Chairperson: ".clean_string($chairperson)."\n";
	$email_message .= "Reviewers Required: ".clean_string($req_reviewers)."\n";
	$email_message .= "Document Abstract: ".clean_string($document_abstract)."\n";
	
	
/// --------------------
/// Create email headers
/// --------------------
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Malier: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>

<!-- HTML Successfull send -->
Form sent successfully.

<?php
}
?>

Thanks for the above ^ I'm just after finishing what I've been doing and it doesnt work - Why I'm not sure but it doesnt. Here is what I have, the code is very long so I'm sorry about that.

When I click submit I don't get any errors but I don't receive any email either so I'm not sure..?? :(

<?php
/// ---------------------------------
/// Including the database connection
/// ---------------------------------

include 'connect_db.php';

/// ----------------------------------------
/// If the form fails, print out error below
/// ----------------------------------------

if(isset($_POST['email'])) 
{
	$email_to = "dave-f-06@hotmail.com";
	$email_subject = "TC Review Requested";
	
	function died($error)
	{
	// Error code here
		echo "Sorry but there has been an error found with the form you submitted. ";
		echo "The errors are below.<br /><br />";
		echo $error."<br /><br />";
		echo "Please retry filling in the form.<br /><br />";
		die();
	}
	
	// Validation
	if(!isset($_POST['doc_title'])		 	||
		!isset($_POST['doc_number'])	 	||
		!isset($_POST['doc_type'])   	 	||
		!isset($_POST['revision'])  	 	||
		!isset($_POST['cdm_link'])  	 	||
		!isset($_POST['mars_link']) 	 	||
		!isset($_POST['checklist_link']) 	||
		!isset($_POST['link_internal_1_3'])     ||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['abstract'])		||
		!isset($_POST['scope'])			||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['type_review'])		||
		!isset($_POST['full_simplified'])	||
		!isset($_POST['pref_earliest'])		||
		!isset($_POST['pref_latest'])		||
		!isset($_POST['proj_name'])		||
		!isset($_POST['auth_name'])		||
		!isset($_POST['req_list'])		||
		!isset($_POST['chairperson'])		||
		!isset($_POST['req_reviewers'])		||
		!isset($_POST['review_duration'])	||
		!isset($_POST['document_abstract']))
		{
			died('There appears to be a problem with the form you submitted.');
		}
	
	$doc_title			= $_POST["doc_title"];			// Required
	$doc_number			= $_POST["doc_number"];			// Required
	$doc_type			= $_POST["doc_type"];			// Required
	$revision			= $_POST["revision"];			// Required
	$cdm_link			= $_POST["cdm_link"];			// Required
	$mars_link 			= $_POST["mars_link"];			// Required
	$checklist_link		= $_POST["checklist_link"];		// Required
	$link_internal_1_3	= $_POST["link_internal_1_3"];	// Required
	$impacted_products	= $_POST["impacted_products"];	// Required
	$abstract 			= $_POST["abstract"];			// Required
	$scope 				= $_POST["scope"];				// Required
	$impacted_products 	= $_POST["impacted_products"];	// Required
	$type_review		= $_POST["type_review"];		// Required
	$full_simplified	= $_POST["full_simplified"];	// Required
	$pref_earliest		= $_POST["pref_earliest"];		// Required
	$pref_latest		= $_POST["pref_latest"];		// Required
	$proj_name			= $_POST["proj_name"];			// Required
	$auth_name 			= $_POST["auth_name"];			// Required
	$req_list			= $_POST["req_list"];			// Required
	$chairperson		= $_POST["chairperson"];		// Required
	$req_reviewers 		= $_POST["req_reviewers"];		// Required
	$review_duration	= $_POST["review_duration"];	// Required
	$document_abstract	= $_POST["document_abstract"];	// Required

	function clean_string($string)
	{	
		$bad = array("content-type", "bcc:", "to:", "cc:", "href");
		return str_replace($bad,"",$string);
	}
	
	$email_message .= "Document Title: ".clean_string($doc_title)."\n";
	$email_message .= "Document Number: ".clean_string($doc_number)."\n";
	$email_message .= "Document Type: ".clean_string($doc_type)."\n";
	$email_message .= "Revision: ".clean_string($revision)."\n";
	$email_message .= "CDM Link: ".clean_string($cdm_link)."\n";
	$email_message .= "Mars Link: ".clean_string($mars_link)."\n";
	$email_message .= "Checklist Link: ".clean_string($checklist_link)."\n";
	$email_message .= "Link to 1/3 /Internal Review: ".clean_string($link_internal_1_3)."\n";
	$email_message .= "Impacted Products: ".clean_string($impacted_products)."\n";
	$email_message .= "Abstract: ".clean_string($abstract)."\n";
	$email_message .= "Scope: ".clean_string($abstract)."\n";
	$email_message .= "Impacted Products: ".clean_string($impacted_products)."\n";
	$email_message .= "Type of Review: ".clean_string($type_review)."\n";
	$email_message .= "Full or Simplified: ".clean_string($full_simplified)."\n";
	$email_message .= "Preferred Earliest Review Dates: ".clean_string($pref_earliest)."\n";
	$email_message .= "Preferred Latest Review Dates: ".clean_string($pref_latest)."\n";
	$email_message .= "Project Name: ".clean_string($proj_name)."\n";
	$email_message .= "Author Name: ".clean_string($auth_name)."\n";
	$email_message .= "List of Required Attendees: ".clean_string($req_reviewers)."\n";
	$email_message .= "Chairperson: ".clean_string($chairperson)."\n";
	$email_message .= "Reviewers Required: ".clean_string($req_reviewers)."\n";
	$email_message .= "Document Abstract: ".clean_string($document_abstract)."\n";
	
	
/// --------------------
/// Create email headers
/// --------------------
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Malier: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>

<!-- HTML Successfull send -->
Form sent successfully.

<?php
}
?>

I prefer the one i did, since you can add any input on the form and it will auto escape the value and add it to the email, but that one should work still.

Where it says
@mail($email_to, $email_subject, $email_message, $headers);
the @ sign in front of a function supresses any errors, so if it is erroring you won't know about it, i would change it to this:

if(mail($email_to, $email_subject, $email_message, $headers)){
echo 'Email sent successfully';
}else{
echo 'Error sending email';
}

and also include this at the very top of the email right after the <?php

<?php
error_reporting(E_ALL);

This tells php to output every error it comes across, notice errors are generally minor and don't need to be fixed - of course best if you did

I prefer the one i did, since you can add any input on the form and it will auto escape the value and add it to the email, but that one should work still.

Where it says
@mail($email_to, $email_subject, $email_message, $headers);
the @ sign in front of a function supresses any errors, so if it is erroring you won't know about it, i would change it to this:

if(mail($email_to, $email_subject, $email_message, $headers)){
echo 'Email sent successfully';
}else{
echo 'Error sending email';
}

and also include this at the very top of the email right after the <?php

<?php
error_reporting(E_ALL);

This tells php to output every error it comes across, notice errors are generally minor and don't need to be fixed - of course best if you did

Thanks, I tried what you said and still doesnt work. I also tried putting exactly what you showed me in the first post (your section of your function) into a new php file and it doesnt work either. I don't understand why my way doesnt work though, can't see where its going wrong :S

The code I have in my other file is fine and the action on the button is this -

<form action = "email.php" method = "post">

<tr>
   <td><input type="submit" name="SubmitDataToForms" value="Submit Form" /></td>
</tr>

When the Submit button is pressed it goes go email.php (Which is the long piece of code I included on the previous page) But I can't see why it doesnt work..

Thanks, I tried what you said and still doesnt work. I also tried putting exactly what you showed me in the first post (your section of your function) into a new php file and it doesnt work either. I don't understand why my way doesnt work though, can't see where its going wrong :S

The code I have in my other file is fine and the action on the button is this -

<form action = "email.php" method = "post">

<tr>
   <td><input type="submit" name="SubmitDataToForms" value="Submit Form" /></td>
</tr>

When the Submit button is pressed it goes go email.php (Which is the long piece of code I included on the previous page) But I can't see why it doesnt work..

My code just stays on the same page as the form, so there should be no action set on your form tag, if you just copy my code straight and paste it into a page and upload it. I just tested it myself, i just had to change the $from & $to variables to my email address and my servers mail@ address and it mailed me this

<h1>Form Filled in at 2012-03-05 14-08-46</h1>
<table>
<tr><td>Field</td><td>Value</td></tr>
<tr><td>formname</td><td>form1</td></tr>
<tr><td>firstname</td><td>test</td></tr>
<tr><td>surname</td><td>test</td></tr>
<tr><td>submit</td><td>TRUE</td></tr>
</table>

In the code you posted above, it will be this bit killing your script:

// Validation
	if(!isset($_POST['doc_title'])		 	||
		!isset($_POST['doc_number'])	 	||
		!isset($_POST['doc_type'])   	 	||
		!isset($_POST['revision'])  	 	||
		!isset($_POST['cdm_link'])  	 	||
		!isset($_POST['mars_link']) 	 	||
		!isset($_POST['checklist_link']) 	||
		!isset($_POST['link_internal_1_3'])     ||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['abstract'])		||
		!isset($_POST['scope'])			||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['type_review'])		||
		!isset($_POST['full_simplified'])	||
		!isset($_POST['pref_earliest'])		||
		!isset($_POST['pref_latest'])		||
		!isset($_POST['proj_name'])		||
		!isset($_POST['auth_name'])		||
		!isset($_POST['req_list'])		||
		!isset($_POST['chairperson'])		||
		!isset($_POST['req_reviewers'])		||
		!isset($_POST['review_duration'])	||
		!isset($_POST['document_abstract']))
		{
			died('There appears to be a problem with the form you submitted.');
		}

Is telling the script if any of them fields don't exist on the form(an input with a name of 'doc_title' etc.), it will halt the script there and not continue

My code just stays on the same page as the form, so there should be no action set on your form tag, if you just copy my code straight and paste it into a page and upload it. I just tested it myself, i just had to change the $from & $to variables to my email address and my servers mail@ address and it mailed me this

<h1>Form Filled in at 2012-03-05 14-08-46</h1>
<table>
<tr><td>Field</td><td>Value</td></tr>
<tr><td>formname</td><td>form1</td></tr>
<tr><td>firstname</td><td>test</td></tr>
<tr><td>surname</td><td>test</td></tr>
<tr><td>submit</td><td>TRUE</td></tr>
</table>

In the code you posted above, it will be this bit killing your script:

// Validation
	if(!isset($_POST['doc_title'])		 	||
		!isset($_POST['doc_number'])	 	||
		!isset($_POST['doc_type'])   	 	||
		!isset($_POST['revision'])  	 	||
		!isset($_POST['cdm_link'])  	 	||
		!isset($_POST['mars_link']) 	 	||
		!isset($_POST['checklist_link']) 	||
		!isset($_POST['link_internal_1_3'])     ||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['abstract'])		||
		!isset($_POST['scope'])			||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['type_review'])		||
		!isset($_POST['full_simplified'])	||
		!isset($_POST['pref_earliest'])		||
		!isset($_POST['pref_latest'])		||
		!isset($_POST['proj_name'])		||
		!isset($_POST['auth_name'])		||
		!isset($_POST['req_list'])		||
		!isset($_POST['chairperson'])		||
		!isset($_POST['req_reviewers'])		||
		!isset($_POST['review_duration'])	||
		!isset($_POST['document_abstract']))
		{
			died('There appears to be a problem with the form you submitted.');
		}

Is telling the script if any of them fields don't exist on the form(an input with a name of 'doc_title' etc.), it will halt the script there and not continue

I tried your code there again in its own file and when I press submit it takes around 30 seconds to do anything then it says successful but I don't receive any email? :S It's as if the page is timing out.

Also I've included the error_reporting(E_ALL) in my code and I don't get any errors on the page but I STILL don't get any emails. Any about the part you said is killing my script, in my other file which is the one that displays the fields on the website I have my fields named like so -

<tr>
	<td>Document Title</td>
	<td><input type = "text" name = "doc_title" size = "51"/></td>
</tr>

Is it something got to do with how I've named my fields in the above section of long code? BTW thanks for the help so far, I appreciate it.

*Edit* - I'm after reading there on a different site that if I am sending HTML emails I should use the PEAR package. Do you think I should?

I've never used pear, i think thats over complicating it.

I notice that $email_from is not set in the code you've pasted, try setting that to something.

Yeah I tried that, also tried it while taking out $email_from and it doesn't work either. Really dont understand where I'm going wrong, I'm just going to post both pieces of code I have and if anyone could help I'd be delighted as I don't see where I am going wrong.

Here is my first part of code -

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>TC OSS RC</title>
<link rel = "stylesheet" type = "text/css" href = "newstylesheet.css" />
</head>

<body>

<?php
/// -------------------------------
///	Include database & header files

/// -------------------------------
include 'newheader.php';
include 'connect_db.php';
?>

<!-- Using "insert.php" file -->
<form action = "email.php" method = "post">

	
<!----------------------- Displaying and positioning the text boxes on screen -------------------------- -->
<table id = "toolDisplayForm">
	<tr>
		<th colspan = "2">Review booking Form for TC OSS RC - Number "Number goes here"</th>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Document Title</td>
		<td><input type = "text" name = "doc_title" size = "51"/></td>
	</tr>

	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Document Number</td>
		<td><input type = "text" name = "doc_number" size = "51"/></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Document Type</td>
		<name = "doc_type" size = "51">
					<td><select>
					<option value = "Pre-PreStudy">Pre-PreStudy</option>
					<option value = "IS">IS</option>
					<option value = "IP">IP</option>
					<option value = "Combined IS/IP">Combined IS/IP</option>
					<option value = "System Execution Doc">System Execution Doc</option>
					<option value = "CPI">CPI</option>
					<option value = "TERE">TERE</option>
					<option value = "Technical Report">Technical Report</option>
					<option value = "Other">Other</option>
					</select></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->		
	
	<tr>
		<td>Revision</td>
		<td><input type = "text" name = "revision" size = "51"/></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>CDM Link to Library where<br />
		the document is stored<br />
		<i><font size = 1>(Must be at least
		5 working days before<br />
		requested review date)</font></i></td>
		<td><textarea name = "cdm_link" cols = 40 rows = 6></textarea></td>
	</tr>
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Mars Link to Derived (Detailed)<br />
		Requirements <br /><font size = 1>(For IS/IP
		Template)</font></td>
		<td><textarea name = "mars_link" cols = 40 rows = 6></textarea></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Link to Checklist</td>
		<td><textarea name = "checklist_link" cols = 40 rows = 6></textarea></td>
	</tr>
		
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Link to 1/3 /Internal
		Review</td>
		<td><textarea name = "link_internal_1_3" cols = 40 rows = 6/></textarea></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Impacted Products</td>
		<td><textarea name = "impacted_products" cols = 40 rows = 6/></textarea></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Abstract (Copy/paste from IS/IP)</td>
	    <td><textarea name = "abstract" cols = 40 rows = 6/></textarea></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>		  
		<td>Scope (Copy/paste from 
		IS/IP <br />
		of 1.3 chapter)</td>
		<td><textarea name = "scope" cols = 40 rows = 6/></textarea></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Impacted Products	
		<font size = 1>(copy/paste of 6.20<br />
		chapter in IS/IP)</font></td>
		<td><textarea name = "impacted_products" cols = 40 rows = 6/></textarea>
	</tr>

	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Type of Review</td>
		<name = "type_review">
			<td><select>
				<option value = "PrimaryReview">Primary Review</option>
				<option value = "ReInspection">Re Inspection</option>
			</select></td>
	</tr>

	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Select Full or Simplified</td>
		<name = "full_simplified">
			<td><select>
				<option value = "FullReview">Full Review</option>
				<option value = "SimplifiedReview">Simplified Review</option>
			</select></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>						
		<td>							
			Preferred Earliest Review Dates<br />
			(YY/MM/DD)
		</td>
		<td><input type = "text" name = "pref_earliest" size = "51"/></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>						
			<td>							
				Preferred Latest Review Dates<br />
				(YY/MM/DD)
			</td>
			<td><input type = "text" name = "pref_latest" size = "51"/></td>
		</tr>

	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
			<td>
			Specify any previous<br />
			TC Reviews</td>
			<td><textarea name = "prev_reviews" cols = 40 rows = 6/></textarea></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>
		<i><font size = 1>Please specify contact information. TC-OSS RC expect that<br /> 
			the author or a representative attends the review. We also welcome a<br />
			representative from the project, such as the Technical Co-Ordinator.</font></i></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Project Name</td>
		<td><input type = "text" size = "51" name = "proj_name"/></td>
	</tr>

	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Author Name</td>
		<td><input type = "text" size = "51" name = "auth_name"/></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	

	<tr>
		<td>List of Required
			Attendees & other<br />
			useful information</td>
		<td><textarea name = "req_list"cols = 40 rows = 6/></textarea></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Chairperson</td>
		<td><input type = "text" size = "51" name = "chairperson" value = "Martin Carey" readonly = "readonly"/></td>
	</tr>

	<!-- -------------------------------------------------------------------------------- -->	

	<tr>
		<td>Reviewers Required</td>
		<name = "doc_type" size = "51">
					<td><select>
					<option value = "Pre-PreStudy">Pre-PreStudy</option>
					<option value = "IS">IS</option>
					<option value = "IP">IP</option>
					<option value = "Combined IS/IP">Combined IS/IP</option>
					<option value = "System Execution Doc">System Execution Doc</option>
					<option value = "CPI">CPI</option>
					<option value = "TERE">TERE</option>
					<option value = "Technical Report">Technical Report</option>
					<option value = "Other">Other</option>
					</select></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	
	<tr>
		<td>Review Duration</td>
		<td><input type = "text" size = "51" name = "review_duration"/>
		</td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
		
	<tr>
		<td>Document Abstract</td>
		<td><input type = "text" size = "51" name = "document_abstract"/></td>
	</tr>
	<!-- -------------------------------------------------------------------------------- -->	

	<!-- Displays the Clear Fields button on the page
			- reset's the form on click -->
	<tr>
		<td><input type="button" name="reset_form" value="Clear Fields" onclick="this.form.reset();"></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	


	<!-- Displays the Submit Form button on page
			- goes to insert.php on click -->
	<tr>
		<td><input type="submit" name="SubmitDataToForms" value="Submit Form" /></td>
	</tr>
	
	<!-- -------------------------------------------------------------------------------- -->	
	<table id = "toolFooter">
	</table>
</table>
</form>
</body>
</html>

Second part of code. Sorry for posting the huge amount of code but I don't no what else to try.

<?php

error_reporting(E_ALL);

/// ---------------------------------
/// Including the database connection
/// ---------------------------------


/// ----------------------------------------
/// If the form fails, print out error below
/// ----------------------------------------

if(isset($_POST['email'])) 
{
	$email_to = "myemail@hotmail.com";
	$email_subject = "TC Review Requested";
	$email_from = "dave-f-06@hotmail.com";
	
	function died($error)
	{
	// Error code here
		echo "Sorry but there has been an error found with the form you submitted. ";
		echo "The errors are below.<br /><br />";
		echo $error."<br /><br />";
		echo "Please retry filling in the form.<br /><br />";
		die();
	}
	
	// Validation
	if(!isset($_POST['doc_title'])		 	||
		!isset($_POST['doc_number'])	 	||
		!isset($_POST['doc_type'])   	 	||
		!isset($_POST['revision'])  	 	||
		!isset($_POST['cdm_link'])  	 	||
		!isset($_POST['mars_link']) 	 	||
		!isset($_POST['checklist_link']) 	||
		!isset($_POST['link_internal_1_3']) ||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['abstract'])			||
		!isset($_POST['scope'])				||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['type_review'])		||
		!isset($_POST['full_simplified'])	||
		!isset($_POST['pref_earliest'])		||
		!isset($_POST['pref_latest'])		||
		!isset($_POST['proj_name'])			||
		!isset($_POST['auth_name'])			||
		!isset($_POST['req_list'])			||
		!isset($_POST['chairperson'])		||
		!isset($_POST['req_reviewers'])		||
		!isset($_POST['review_duration'])	||
		!isset($_POST['document_abstract']))
		{
			died('There appears to be a problem with the form you submitted.');
		}
	
	$doc_title			= $_POST["doc_title"];			// Required
	$doc_number			= $_POST["doc_number"];			// Required
	$doc_type			= $_POST["doc_type"];			// Required
	$revision			= $_POST["revision"];			// Required
	$cdm_link			= $_POST["cdm_link"];			// Required
	$mars_link 			= $_POST["mars_link"];			// Required
	$checklist_link		= $_POST["checklist_link"];		// Required
	$link_internal_1_3	= $_POST["link_internal_1_3"];	// Required
	$impacted_products	= $_POST["impacted_products"];	// Required
	$abstract 			= $_POST["abstract"];			// Required
	$scope 				= $_POST["scope"];				// Required
	$impacted_products 	= $_POST["impacted_products"];	// Required
	$type_review		= $_POST["type_review"];		// Required
	$full_simplified	= $_POST["full_simplified"];	// Required
	$pref_earliest		= $_POST["pref_earliest"];		// Required
	$pref_latest		= $_POST["pref_latest"];		// Required
	$proj_name			= $_POST["proj_name"];			// Required
	$auth_name 			= $_POST["auth_name"];			// Required
	$req_list			= $_POST["req_list"];			// Required
	$chairperson		= $_POST["chairperson"];		// Required
	$req_reviewers 		= $_POST["req_reviewers"];		// Required
	$review_duration	= $_POST["review_duration"];	// Required
	$document_abstract	= $_POST["document_abstract"];	// Required

	function clean_string($string)
	{	
		$bad = array("content-type", "bcc:", "to:", "cc:", "href");
		return str_replace($bad,"",$string);
	}
	
	$email_message .= "Document Title: ".clean_string($doc_title)."\n";
	$email_message .= "Document Number: ".clean_string($doc_number)."\n";
	$email_message .= "Document Type: ".clean_string($doc_type)."\n";
	$email_message .= "Revision: ".clean_string($revision)."\n";
	$email_message .= "CDM Link: ".clean_string($cdm_link)."\n";
	$email_message .= "Mars Link: ".clean_string($mars_link)."\n";
	$email_message .= "Checklist Link: ".clean_string($checklist_link)."\n";
	$email_message .= "Link to 1/3 /Internal Review: ".clean_string($link_internal_1_3)."\n";
	$email_message .= "Impacted Products: ".clean_string($impacted_products)."\n";
	$email_message .= "Abstract: ".clean_string($abstract)."\n";
	$email_message .= "Scope: ".clean_string($abstract)."\n";
	$email_message .= "Impacted Products: ".clean_string($impacted_products)."\n";
	$email_message .= "Type of Review: ".clean_string($type_review)."\n";
	$email_message .= "Full or Simplified: ".clean_string($full_simplified)."\n";
	$email_message .= "Preferred Earliest Review Dates: ".clean_string($pref_earliest)."\n";
	$email_message .= "Preferred Latest Review Dates: ".clean_string($pref_latest)."\n";
	$email_message .= "Project Name: ".clean_string($proj_name)."\n";
	$email_message .= "Author Name: ".clean_string($auth_name)."\n";
	$email_message .= "List of Required Attendees: ".clean_string($req_reviewers)."\n";
	$email_message .= "Chairperson: ".clean_string($chairperson)."\n";
	$email_message .= "Reviewers Required: ".clean_string($req_reviewers)."\n";
	$email_message .= "Document Abstract: ".clean_string($document_abstract)."\n";
	
	
	
	

/// --------------------
/// Create email headers
/// --------------------
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Malier: PHP/' . phpversion();

if(mail($email_to, $email_subject, $email_message, $headers))
{
	echo 'Email sent successfully';
}
else
{
	echo 'Error sending email';
}
?>

<!-- HTML Successfull send -->
Form sent successfully.

<?php
}
?>
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion(); // <-- not sure if this is the problem (Malier)
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion(); // <-- not sure if this is the problem (Malier)

I'm after changing it there - Took out this:

$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();// Realised I had Mailer spelt wrong - Still doesn't work

But still doesn't work. Any other idea's? I don't even want a fancy email in HTML yet, I just want to get it working so I'm receiving the data that is put into the form by the user.

When I press submit I don't get any error, but it also doesn't echo out any statements like I want it to above?

the first line says "if(isset($_POST)"

but i don't see that field on your form

^ Yeah sorry I actually do have it though I changed it earlier and now it's working except Im getting errors now, but it's not saying the errors:

[IMG]http://i43.tinypic.com/1zmjxax.jpg[/IMG]


I changed the above thing you mentioned to this by the way:

<tr>
		<td><input type="submit" name="email" value="Submit Form" /></td>
</tr>

Would it have anything got to do with me having drop down lists in my form maybe?!

^ Yeah sorry I actually do have it though I changed it earlier and now it's working except Im getting errors now, but it's not saying the errors:

[IMG]http://i43.tinypic.com/1zmjxax.jpg[/IMG]


I changed the above thing you mentioned to this by the way:

<tr>
		<td><input type="submit" name="email" value="Submit Form" /></td>
</tr>

Would it have anything got to do with me having drop down lists in my form maybe?!

That error in your picture comes from here:

function died($error)
	{
	// Error code here
		echo "Sorry but there has been an error found with the form you submitted. ";
		echo "The errors are below.<br /><br />";
		echo $error."<br /><br />";
		echo "Please retry filling in the form.<br /><br />";
		die();
	}
 
	// Validation
	if(!isset($_POST['doc_title'])		 	||
		!isset($_POST['doc_number'])	 	||
		!isset($_POST['doc_type'])   	 	||
		!isset($_POST['revision'])  	 	||
		!isset($_POST['cdm_link'])  	 	||
		!isset($_POST['mars_link']) 	 	||
		!isset($_POST['checklist_link']) 	||
		!isset($_POST['link_internal_1_3'])     ||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['abstract'])		||
		!isset($_POST['scope'])			||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['type_review'])		||
		!isset($_POST['full_simplified'])	||
		!isset($_POST['pref_earliest'])		||
		!isset($_POST['pref_latest'])		||
		!isset($_POST['proj_name'])		||
		!isset($_POST['auth_name'])		||
		!isset($_POST['req_list'])		||
		!isset($_POST['chairperson'])		||
		!isset($_POST['req_reviewers'])		||
		!isset($_POST['review_duration'])	||
		!isset($_POST['document_abstract']))
		{
			died('There appears to be a problem with the form you submitted.');
		}

It will fire if any one of the post fields is not set and is case sensitive

try adding var_dump($_POST); to it so you can see which one isn't set / misspelt

function died($error)
	{
	// Error code here
		echo "Sorry but there has been an error found with the form you submitted. ";
		echo "The errors are below.<br /><br />";
		echo $error."<br /><br />";
		echo "Please retry filling in the form.<br /><br />";
		var_dump($_POST);
		die();
	}

That error in your picture comes from here:

function died($error)
	{
	// Error code here
		echo "Sorry but there has been an error found with the form you submitted. ";
		echo "The errors are below.<br /><br />";
		echo $error."<br /><br />";
		echo "Please retry filling in the form.<br /><br />";
		die();
	}
 
	// Validation
	if(!isset($_POST['doc_title'])		 	||
		!isset($_POST['doc_number'])	 	||
		!isset($_POST['doc_type'])   	 	||
		!isset($_POST['revision'])  	 	||
		!isset($_POST['cdm_link'])  	 	||
		!isset($_POST['mars_link']) 	 	||
		!isset($_POST['checklist_link']) 	||
		!isset($_POST['link_internal_1_3'])     ||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['abstract'])		||
		!isset($_POST['scope'])			||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['type_review'])		||
		!isset($_POST['full_simplified'])	||
		!isset($_POST['pref_earliest'])		||
		!isset($_POST['pref_latest'])		||
		!isset($_POST['proj_name'])		||
		!isset($_POST['auth_name'])		||
		!isset($_POST['req_list'])		||
		!isset($_POST['chairperson'])		||
		!isset($_POST['req_reviewers'])		||
		!isset($_POST['review_duration'])	||
		!isset($_POST['document_abstract']))
		{
			died('There appears to be a problem with the form you submitted.');
		}

It will fire if any one of the post fields is not set and is case sensitive

try adding var_dump($_POST); to it so you can see which one isn't set / misspelt

function died($error)
	{
	// Error code here
		echo "Sorry but there has been an error found with the form you submitted. ";
		echo "The errors are below.<br /><br />";
		echo $error."<br /><br />";
		echo "Please retry filling in the form.<br /><br />";
		var_dump($_POST);
		die();
	}

I've tried it with the var_dump and this is the error I'm getting now:

http://i40.tinypic.com/34ou0l2.jpg

I still can't see though where it's going wrong. Could it be anything got to do with my drop down lists at all? I honestly don't no why it's not working.

This is the example I took it from: http://www.freecontactform.com/email_form.php
And I just copied and pasted that example and it worked, so I can't see why it's not working for me as I've done exactly what's in that link apart from checking the emails and name etc. ie this part:

if(!preg_match($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  }
    $string_exp = "/^[A-Za-z .'-]+$/";
  if(!preg_match($string_exp,$first_name)) {
    $error_message .= 'The First Name you entered does not appear to be valid.<br />';
  }

yes and theres your error.

the php script is erroring if any of these fields are not set:

if(!isset($_POST['doc_title'])		 	||
		!isset($_POST['doc_number'])	 	||
		!isset($_POST['doc_type'])   	 	||
		!isset($_POST['revision'])  	 	||
		!isset($_POST['cdm_link'])  	 	||
		!isset($_POST['mars_link']) 	 	||
		!isset($_POST['checklist_link']) 	||
		!isset($_POST['link_internal_1_3'])     ||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['abstract'])		||
		!isset($_POST['scope'])			||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['type_review'])		||
		!isset($_POST['full_simplified'])	||
		!isset($_POST['pref_earliest'])		||
		!isset($_POST['pref_latest'])		||
		!isset($_POST['proj_name'])		||
		!isset($_POST['auth_name'])		||
		!isset($_POST['req_list'])		||
		!isset($_POST['chairperson'])		||
		!isset($_POST['req_reviewers'])		||
		!isset($_POST['review_duration'])	||
		!isset($_POST['document_abstract']))
		{
			died('There appears to be a problem with the form you submitted.');
		}

in the var_dump i cant see these 5 fields:
doc_type
impacted_products
type_review
full_simplified
req_reviewers

so it sends an error, there may be more missing its hard to tell with it being an image

yes and theres your error.

the php script is erroring if any of these fields are not set:

if(!isset($_POST['doc_title'])		 	||
		!isset($_POST['doc_number'])	 	||
		!isset($_POST['doc_type'])   	 	||
		!isset($_POST['revision'])  	 	||
		!isset($_POST['cdm_link'])  	 	||
		!isset($_POST['mars_link']) 	 	||
		!isset($_POST['checklist_link']) 	||
		!isset($_POST['link_internal_1_3'])     ||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['abstract'])		||
		!isset($_POST['scope'])			||
		!isset($_POST['impacted_products'])	||
		!isset($_POST['type_review'])		||
		!isset($_POST['full_simplified'])	||
		!isset($_POST['pref_earliest'])		||
		!isset($_POST['pref_latest'])		||
		!isset($_POST['proj_name'])		||
		!isset($_POST['auth_name'])		||
		!isset($_POST['req_list'])		||
		!isset($_POST['chairperson'])		||
		!isset($_POST['req_reviewers'])		||
		!isset($_POST['review_duration'])	||
		!isset($_POST['document_abstract']))
		{
			died('There appears to be a problem with the form you submitted.');
		}

in the var_dump i cant see these 5 fields:
doc_type
impacted_products
type_review
full_simplified
req_reviewers

so it sends an error, there may be more missing its hard to tell with it being an image

Ahhhh, I see now what you mean. My doc type, impacted products and the rest of that list are actually drop down selections. So could that be a problem? Here's a picture to show what I mean:

http://i43.tinypic.com/2zz2txf.jpg

http://i40.tinypic.com/2hdnmmf.jpg

The error image I posted is the whole error, there's none of the image missing.

that wont be a problem, though i don't get why they arn't set.

they should be named like so

<select name='doc_type'>
<option value='' SELECTED>-Please Select-</option>
<option value='IS'>IS</option>
<option value='IP'>IP</option>
<option value='CPI'>CPI</option>
</select>

the please select one is optional, you can set any option to be the default selected

that wont be a problem, though i don't get why they arn't set.

they should be named like so

<select name='doc_type'>
<option value='' SELECTED>-Please Select-</option>
<option value='IS'>IS</option>
<option value='IP'>IP</option>
<option value='CPI'>CPI</option>
</select>

the please select one is optional, you can set any option to be the default selected

Thanks for that. I've changed it now to this:

<tr>
		<td>Document Type</td>
		<name = "doc_type" size = "51">
					<td><select>
					<option value ='' SELECTED>-Please Select-</option>
					<option value = "Pre-PreStudy">Pre-PreStudy</option>
					<option value = "IS">IS</option>
					<option value = "IP">IP</option>
					<option value = "Combined IS/IP">Combined IS/IP</option>
					<option value = "System Execution Doc">System Execution Doc</option>
					<option value = "CPI">CPI</option>
					<option value = "TERE">TERE</option>
					<option value = "Technical Report">Technical Report</option>
					<option value = "Other">Other</option>
					</select></td>
	</tr>

And this is how the drop down menu is appearing:

http://i41.tinypic.com/of20yf.jpg

But when I retry filling in the form again I still get the same error as the one I posted above and doc_type STILL isn't filled in. It's as if it skips doc_type..

Thanks for that. I've changed it now to this:

<tr>
		<td>Document Type</td>
		<name = "doc_type" size = "51">
					<td><select>
					<option value ='' SELECTED>-Please Select-</option>
					<option value = "Pre-PreStudy">Pre-PreStudy</option>
					<option value = "IS">IS</option>
					<option value = "IP">IP</option>
					<option value = "Combined IS/IP">Combined IS/IP</option>
					<option value = "System Execution Doc">System Execution Doc</option>
					<option value = "CPI">CPI</option>
					<option value = "TERE">TERE</option>
					<option value = "Technical Report">Technical Report</option>
					<option value = "Other">Other</option>
					</select></td>
	</tr>

And this is how the drop down menu is appearing:

http://i41.tinypic.com/of20yf.jpg

But when I retry filling in the form again I still get the same error as the one I posted above and doc_type STILL isn't filled in. It's as if it skips doc_type..

thats not right it needs to be like this:

<tr>
		<td>Document Type</td>
					<td><select name = "doc_type" size = "51">
					<option value ='' SELECTED>-Please Select-</option>
					<option value = "Pre-PreStudy">Pre-PreStudy</option>
					<option value = "IS">IS</option>
					<option value = "IP">IP</option>
					<option value = "Combined IS/IP">Combined IS/IP</option>
					<option value = "System Execution Doc">System Execution Doc</option>
					<option value = "CPI">CPI</option>
					<option value = "TERE">TERE</option>
					<option value = "Technical Report">Technical Report</option>
					<option value = "Other">Other</option>
					</select></td>
	</tr>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.