Email Date of Birth problem


I have very basic enquiry form scirpt so when a user fills in some fields an email is sent to the webmasters email address.

The issue I am having is I have an option for some one to enter their date of birth - (3 fields - day, month, year). - When the webmaster receives an email they see the date of birth like this (on 3 lines):

Dob day: 18

Dob month: June

Dob year: 1987

Preferably I would like it - Dob: 18 June 1987

Does anyone have any suggestions?

Below is the code for the enquiry form:

$my_email = "";

$continue = "/";

$errors = array();

// Remove $_COOKIE elements from $_REQUEST.

if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}

// Build message.

function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}

$message = build_message($_REQUEST);

$message = stripslashes($message);

$subject = "General Enquiry";

$subject = stripslashes($subject);

$from_Name = "";

if(isset($_REQUEST['Name']) && !empty($_REQUEST['Name'])){$from_Name = stripslashes($_REQUEST['Name']);}

$headers = "From: {$from_Name} <{$_REQUEST['Email']}>";


$message = "Thank you for your enquiry. We will be in touch with you as soon as possible.


Website Name";

$subject = "General Enquiry";

$headers = "From: Website Name <>";


The field names for the dob are: dob_day, dob_month, dob_year

I don’t know if there is some kind of code or something that can be implemented into the form which allows the 3 to be viewed on 1 seperate line rather than 3.

If anyone has any suggestions or can help in any way that would be absolutely fantastic.



That’s a good shout - I did what to the it the absolute simplest method possible as there will be numerous different forms linking to this file.

But if it means doing a couple different variations thats fine.

Cheers for your help - really appreciate it.


Instead of the foreach statement for building your message write the message out and use the actual variables. It takes a little more setup, but you will have full control over your data.