Currently I have a php script that gets only the information filled out online, sends to me in .csv attach and in html format. What I need:
-
If the prospect does not fill out the field, the field is not recorded into the csv file, so I set every field to have text “.” on the html side… so every field is comes up. I want to capture every field without putting “.” in the html. Help.
-
When i receive the confirmation email of the prospect,the information captured comes 2 me as actual code of the a list format as well as in the csv file too
example:
html code: <input autocomplete=“OFF” id=“BorFirstName” name=“BorFirstName”…>
I receive this in my email, I rather have “First Name” than “BorFirstName”
[table]
[tr]
[td]BorFirstName[/td][td]Jennifer xxxx[/td]
[/tr]
[tr]
[td]BorWorkPhone[/td][td] …2xxxxxx[/td]
[/tr]
[/table]
-
How do I add the Name of the prospect to my subject?
Currently I have : $subject = "NEW: Client Lead: ".$_POST[‘email’]; ;
-
I can get the csv and do a mail merge with ms word yet Can I have the information the client out to me emailed into an as html loan application format to my email?
HERE are My PHP code :
[php]
<?php
/*
Copy the code below as it is, and paste it into your webpage:
Enter the email address below to send the contents of the form to. If desired, you can enter more than one email address separated by commas, like so: $my_email = "
[email protected],
[email protected],
[email protected]";
*/
$my_email = "
[email protected]";
/*
Subject line. The default subject line for the email that is sent to you, is shown below. To change this, enter your own subject between the quotes. Make sure that you use a subject that will get past any spam filters you might use.
*/
$subject = "NEW:Client Lead: ".$_POST['email']; ;
/*
Continue link.
*/
$continue = "http://www.mydomain.com";
/*
Automatic redirect. If you would like the visitor to be automatically redirected to another page (or site) when they submit the form (as opposed to getting the standard "thank you" message) change the value below to 1, like so: $auto_redirect = 1;
*/
$auto_redirect = 0;
/*
Enter the web address of the page that you would like the visitor to be automatically redirected to (between the quotes below). You only need to do this if you have enabled the auto redirect above. You can redirect them to any page on any site, it doesn't have to be a page on your own site. It is advisable to write the full URL like so: $redirect_url = "http://example.com/thankyou.htm";
*/
$redirect_url = "http://www.mydomain.com/loc.html";
/*
Required fields.
*/
$required_fields_check = 1;
/*
Specify which fields to require.
*/
$required_fields = array(
'BorFirstName',
'email',
);
/*
IP address display. If you enable this, the email sent to you will have the sender's IP address shown at the bottom. To enable it, change the value to 1, like so: $show_ip = 1;
*/
$show_ip = 1;
/*
Check for banned IPs. You can ban specific IP addresses or IP address classes from using your form. To enable checking for these, change the value below to 1, like so: $banned_ips_check = 1;
*/
$banned_ips_check = 1;
/*
Banned IPs.
*/
$banned_ips = array();
/*
Banned IP message.
*/
$banned_ip_message = "Your IP address is banned. The form was not sent.";
/*
Cookie requirement.
*/
$require_cookie = 0;
/*
Referrer check.
*/
$check_referrer = 0;
/*
Word block.
*/
$word_block = 1;
/*
Blocked words.
*/
$blocked_words = array('http://','https://','viagra');
/*
Gobbledegook check. You sometimes get spam consisting of gobbledegook characters (Å ð ç etc). This check will prevent any messages getting through if gobbledegook is found. This check is done by default. To disable it, change the value to 0, like so: $gobbledegook_check = 0;
*/
$gobbledegook_check = 1;
/*
identiPIC photo CAPTCHA system.
*/
$identiPIC_photo_CAPTCHA = 0;
/*
*/
$identiPIC[1] = "Apple";
$identiPIC[2] = "Flower";
$identiPIC[3] = "Fork";
/*
HTML formatting.
*/
$html_format = 1;
/*
HTML output customizing.
*/
$table_cellpadding = "5";
$table_cellspacing = "1";
$table_background_color = "#000000";
$table_left_column_color = "#ececec";
$table_left_column_font = "arial";
$table_left_column_font_size = "10";
$table_left_column_font_color = "#000000";
$table_right_column_color = "#ffffff";
$table_right_column_font = "arial";
$table_right_column_font_size = "10";
$table_right_column_font_color = "#000000";
/*
CSV attachment.
*/
$csv_attachment = 1;
/*
CSV file on server.
*/
$csv_file_on_server = 1;
/*
*/
$csv_filename = "mydomain.csv";
/*
End of configuration options.
*/
$errors = array();
// Remove $_COOKIE elements from $_REQUEST.
if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}
// Check all fields for an email header.
function recursive_array_check_header($element_value)
{
global $set;
if(!is_array($element_value)){if(preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i",$element_value)){$set = 1;}}
else
{
foreach($element_value as $value){if($set){break;} recursive_array_check_header($value);}
}
}
recursive_array_check_header($_REQUEST);
if($set){$errors[] = "You cannot send an email header";}
unset($set);
// Validate email field.
if(isset($_REQUEST['email']) && !empty($_REQUEST['email']))
{
if(preg_match("/(%0A|%0D|\n+|\r+|:)/i",$_REQUEST['email'])){$errors[] = "Email address may not contain a new line or a colon";}
$_REQUEST['email'] = trim($_REQUEST['email']);
if(substr_count($_REQUEST['email'],"@") != 1 || stristr($_REQUEST['email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0 || substr_count($exploded_email[1],".") > 3){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $key => $value){if($key == 0){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}elseif(strlen($value) > 6 || !preg_match('/^[a-z0-9]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}}
}
// Remove leading whitespace from all values.
function recursive_array_check(&$element_value)
{
if(!is_array($element_value)){$element_value = ltrim($element_value);}
else
{
foreach($element_value as $key => $value){$element_value[$key] = recursive_array_check($value);}
}
return $element_value;
}
recursive_array_check($_REQUEST);
// Test for cookie.
if($require_cookie)
{
if(!isset($_COOKIE['formmail'])){$errors[] = "You must enable cookies to use the form";}
}
// Check referrer.
if($check_referrer)
{
//if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}
}
// Check identiPIC photo CAPTCHA.
if($identiPIC_photo_CAPTCHA)
{
// Give an error if $_REQUEST['identiPIC_selected'] is not set, a bot might not send it. If set then give an error if it is not identical to the $identiPIC array.
if(!isset($_REQUEST['identiPIC_selected'])){$errors[] = "You have failed to identify the pictures correctly. Please try again.";}else{if($_REQUEST['identiPIC_selected'] !== $identiPIC){$errors[] = "You have failed to identify the pictures correctly. Please try again.";} unset($_REQUEST['identiPIC_selected']);}
}
// Check for required fields. If none, don't allow blank form to be sent.
if($required_fields_check)
{
foreach($required_fields as $value){if((!isset($_REQUEST[$value]) || empty($_REQUEST[$value])) && (!isset($_FILES[$value]['name']) || empty($_FILES[$value]['name']))){$errors[] = "Please go back and complete the $value field";}}
}else{
// Check for a blank form.
function recursive_array_check_blank($element_value)
{
global $set;
if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}
else
{
foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}
}
}
recursive_array_check_blank($_REQUEST);
if(!$set){$errors[] = "You cannot send a blank form";}
unset($set);
}
// Check for banned IPs.
if($banned_ips_check)
{
foreach($banned_ips as $value)
{
if($value == substr($_SERVER[REMOTE_ADDR], 0, strlen($value))){$errors[] = $banned_ip_message; break;}
}
}
// Check all fields for gobbledegook.
if($gobbledegook_check)
{
$gobbledegook_alphabet = array('¡','¢','¤','¦','§','¨','ª','«','¬','®','¯','°','±','²','³','µ','¶','·','¸','¹','º','»','¼','½','¾','¿','À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','×','Ø','Ù','Ú','Û','Ü','Ý','Þ','ß','à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ð','ñ','ó','õ','ö','÷','ø','ú','û','ü','ý','þ');
function recursive_array_check_gobbledegook($element_value,$inkey = "")
{
global $set;
global $gobbledegook_alphabet;
global $return_value;
global $return_key;
if(!is_array($element_value))
{
foreach($gobbledegook_alphabet as $value){if(stristr($element_value,$value)){$set = 1; $return_value = $value; $return_key = $inkey; break;}}
}else{
foreach($element_value as $key => $value){if($set){break;} recursive_array_check_gobbledegook($value,$key);}
}
}
recursive_array_check_gobbledegook($_REQUEST);
if($set){if(is_numeric($return_key)){$errors[] = "You have entered an invalid character ($return_value)";}else{$errors[] = "You have entered an invalid character ($return_value) in the \"$return_key\" field";}}
unset($set);
unset($return_value);
unset($return_key);
}
// Check for blocked words/web addresses.
if($word_block)
{
function recursive_array_check_word_block($element_value,$inkey = "")
{
global $set;
global $blocked_words;
global $return_value;
global $return_key;
if(!is_array($element_value))
{
foreach($blocked_words as $value){if(stristr($element_value,$value)){$set = 1; $return_value = $value; $return_key = $inkey; break;}}
}else{
foreach($element_value as $key => $value){if($set){break;} recursive_array_check_word_block($value,$key);}
}
}
recursive_array_check_word_block($_REQUEST);
if($set){if(is_numeric($return_key)){$errors[] = "You have entered an invalid string ($return_value)";}else{$errors[] = "You have entered an invalid string ($return_value) in the \"$return_key\" field";}}
unset($set);
unset($return_value);
unset($return_key);
}
// Display any errors and exit if errors exist.
if(count($errors)){foreach($errors as $value){print "$value
";} exit;}
if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");}
// HTML format the output.
if($html_format)
{
// Allow posted HTML code to be displayed (and not executed). Convenient time to do nl2br.
function recursive_array_check_HTML(&$element_value)
{
if(!is_array($element_value)){$element_value = nl2br(htmlentities($element_value));}
else
{
foreach($element_value as $key => $value){$element_value[$key] = recursive_array_check_HTML($value);}
}
return $element_value;
}
recursive_array_check_HTML($_REQUEST);
$html_open = "$subject
"; $content_type = "html";}else{$html_open = ""; $colon_sep = ": "; $html_close = ""; $content_type = "plain";}
function build_message($request_input)
{
global $colon_sep;
global $html_format;
global $table_left_column_color;
global $table_left_column_font;
global $table_left_column_font_size;
global $table_left_column_font_color;
global $table_right_column_color;
global $table_right_column_font;
global $table_right_column_font_size;
global $table_right_column_font_color;
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($html_format){if(!is_numeric($key)){$message_output .= "
".str_replace("_"," ",ucfirst($key))." |
".build_message($value)." |
";}else{$message_output .= "
".build_message($value)." |
";}}else{if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).$colon_sep.build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}}return rtrim($message_output,", ");
}
// Show sender's IP address.
if($show_ip){$_REQUEST["Sender's IP address"] = $_SERVER[REMOTE_ADDR];}
$message = $html_open;
$message .= build_message($_REQUEST);
$message .= $html_close;
// Strip slashes.
$message = stripslashes($message);
$headers = "From: " . $_REQUEST['email'];
if($csv_attachment || $csv_file_on_server)
{
function build_file_data($data_input)
{
if(!isset($file_data)){$file_data = "";}if(!is_array($data_input)){if(stristr($data_input,'"')){$data_input = str_replace('"','""',$data_input);} if(stristr($data_input,'"') || stristr($data_input,",") || stristr($data_input,"\n") || stristr($data_input,"\r\n")){$file_data = "\"$data_input\"";}else{$file_data = $data_input;}}else{foreach($data_input as $key => $value){if(!is_numeric($key)){$file_data .= build_file_data($value).",";}else{$file_data .= build_file_data($value)." :: ";}}}return rtrim(rtrim($file_data,",")," :: ");
}
}
if(count($_FILES) || $csv_attachment)
{
if(count($_FILES))
{
$attachment_array = array();
foreach(array_keys($_FILES) as $value)
{
if(is_uploaded_file($_FILES[$value]['tmp_name']))
{
$file = fopen($_FILES[$value]['tmp_name'],'rb');
$data = fread($file,filesize($_FILES[$value]['tmp_name']));
fclose($file);
$data = chunk_split(base64_encode($data));
$attachment_array[] = "--boundary_sdfsfsdfs345345sfsgs".PHP_EOL."Content-Type: ".$_FILES[$value]['type'].";".PHP_EOL." name=\"".$_FILES[$value]['name']."\"".PHP_EOL."Content-Disposition: attachment;".PHP_EOL." filename=\"".$_FILES[$value]['name']."\"".PHP_EOL."Content-Transfer-Encoding: base64".PHP_EOL.PHP_EOL.$data.PHP_EOL.PHP_EOL;
}
}
}
if(count($attachment_array) || $csv_attachment)
{
$headers .= PHP_EOL;
$headers .= "MIME-Version: 1.0".PHP_EOL;
$headers .= "Content-Type: multipart/mixed;".PHP_EOL;
$headers .= " boundary=\"boundary_sdfsfsdfs345345sfsgs\"";
$body = "";
$body .= "--boundary_sdfsfsdfs345345sfsgs".PHP_EOL;
$body .= "Content-Type: text/".$content_type."; charset=\"iso-8859-1\"".PHP_EOL.PHP_EOL;
$body .= $message.PHP_EOL.PHP_EOL;
if(count($attachment_array)){foreach($attachment_array as $value){$body .= $value;}}
if($csv_attachment)
{
// Comma separate the keys (doesn't need to be recursive).
$data = "";
foreach(array_keys($_REQUEST) as $value){$data .= "$value,";}
// Remove trailing comma.
$data = rtrim($data,",");
$data .= PHP_EOL;
$data .= stripslashes(build_file_data($_REQUEST));
$body .= "--boundary_sdfsfsdfs345345sfsgs".PHP_EOL."Content-Type: text/plain; charset=\"iso-8859-1\"".PHP_EOL." name=\"$csv_filename\"".PHP_EOL."Content-Disposition: attachment;".PHP_EOL." filename=\"$csv_filename\"".PHP_EOL.PHP_EOL.$data.PHP_EOL.PHP_EOL;
}
$body .= "--boundary_sdfsfsdfs345345sfsgs--";
$message = $body;
}
}
if($html_format && !count($attachment_array) && !$csv_attachment)
{
$headers .= PHP_EOL;
$headers .= "MIME-Version: 1.0".PHP_EOL;
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"";
}
// Send email.
mail($my_email,$subject,$message,$headers);
// Write to CSV file.
if($csv_file_on_server)
{
$path_to_file = dirname(__FILE__) . "/";
// If file does not exist, create it and write header row.
if(!file_exists($path_to_file.$csv_filename))
{
$data = "";
foreach(array_keys($_REQUEST) as $value){$data .= "$value,";}
// Remove trailing comma.
$data = rtrim($data,",");
$data .= "\r\n";
$handle = fopen($path_to_file.$csv_filename, "a");
fwrite($handle,$data);
fclose($handle);
}
// Write data row.
$data = "";
$data .= stripslashes(build_file_data($_REQUEST));
$data .= "\r\n";
$handle = fopen($path_to_file.$csv_filename, "a");
fwrite($handle,$data);
fclose($handle);
}
// Redirect or display "thank you" message.
if($auto_redirect){header("location: $redirect_url"); exit;}
?>
Thank You
Thank you <?php print stripslashes($_REQUEST['name']); ?>
Your Request has been submitted. Please click below to finish your request.
Click here to continue
|
[/php]