Я пытаюсь создать эту форму sendmail, но она не будет отображать какие-либо входные данные или помещает их в другое поле, хотя некоторые из них, по-видимому, работают по какой-то причине. У меня есть форма на http://nomaddad.net/market/apply.html
PHP, который я использую для этого:
<?php
/*
This first bit sets the email address that you want the form to be submitted to.
You will need to change this value to a valid email address that you can access.
*/
$webmaster_email = "admin@centennialmarket.ca";
/*
This bit sets the URLs of the supporting pages.
If you change the names of any of the pages, you will need to change the values here.
*/
$feedback_page = "../contact.html";
$error_page = "error_message.html";
$thankyou_page = "../thankyou.html";
/*
This next bit loads the form field data into variables.
If you add a form field, you will need to add it here.
*/
$busname = $_REQUEST['busname'] ;
$Applicant = $_REQUEST['Applicant'] ;
$street = $_REQUEST['street'] ;
$apartment = $_REQUEST['apartment'] ;
$city = $_REQUEST['city'] ;
$province = $_REQUEST['province'] ;
$postal = $_REQUEST['postal'] ;
$mainphone = $_REQUEST['mainphone'] ;
$cellphone = $_REQUEST['cellphone'] ;
$email_address = $_REQUEST['email_address'] ;
$website = $_REQUEST['website'] ;
$category = $_REQUEST['category'] ;
$directorder = $_REQUEST['directorder'] ;
$other = $_REQUEST['other'] ;
$Productdescription = $_REQUEST['Productdescription'] ;
$OctDates = $_REQUEST['OctDates'] ;
$NovDates = $_REQUEST['NovDates'] ;
$DecDates = $_REQUEST['DecDates'] ;
$Power = $_REQUEST['Power'] ;
$Powerfor = $_REQUEST['Powerfor'] ;
$websitepermission = $_REQUEST['websitepermission'] ;
$checkbox = $_REQUEST['checkbox'] ;
$Rules = $_REQUEST['Rules'] ;
$msg =
"Business Name: " . $busname . "\r\n" .
"Applicant Name: " . $Applicant . "\r\n" .
"Street: " . $street . "\r\n" .
"apartment: " . $apartment . "\r\n" .
"City: " . $city . "\r\n" .
"Province: " . $province . "\r\n" .
"Postal Code: " . $postal . "\r\n" .
"Main Phone: " . $mainphone . "\r\n" .
"Cell Phone: " . $cellphone . "\r\n" .
"Email: " . $email_address . "\r\n" .
"Website: " . $website . "\r\n" .
"Product Category: " . $category . "\r\n" .
"Direct Order: " . $directorder . "\r\n" .
"Other: " . $other . "\r\n" .
"Product Description: " . $Productdescription . "\r\n" .
"October Dates: " . $OctDates . "\r\n" .
"November Dates: " . $NovDates . "\r\n" .
"December Dates: " . $DecDates . "\r\n" .
"Power: " . $Power . "\r\n" .
"Power For: " . $Powerfor . "\r\n" .
"Website Permission: " . $websitepermission . "\r\n" .
"Info to give out: " . $checkbox . "\r\n" .
"Read the Rules: " . $Rules ;
/*
The following function checks for email injection.
Specifically, it checks for carriage returns - typically used by spammers to inject a CC list.
*/
function isInjected($str) {
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str)) {
return true;
}
else {
return false;
}
}
/*
// If the user tries to access this script directly, redirect them to the feedback form,
if (!isset($_REQUEST['email_address'])) {
header( "Location: $feedback_page" );
}
// If the form fields are empty, redirect to the error page.
if (empty($Applicant) || empty($email_address)) {
header( "Location: $error_page" );
}
*/
/*
If email injection is detected, redirect to the error page.
If you add a form field, you should add it here.
*//*
elseif ( isInjected($email_address) || isInjected($Applicant) || isInjected($busname) || isInjected($postal) || isInjected($Street) || isInjected($city) || isInjected($Applicant) ||) {
header( "Location: $error_page" );
}
// If we passed all previous tests, send the email then redirect to the thank you page.
else*/ {
mail( "$webmaster_email", "Feedback Form Results", $msg );
header( "Location: $thankyou_page" );
}
?>
И результат, который я получаю по электронной почте:
Название компании:
Имя заявителя: имя заявителя
Улица: www.tallgrassapparel.com
квартира:
Город:
Провинция:
Почтовый индекс:
Основной телефон:
Сотовый телефон:
Электронная почта:
Веб-сайт:
Категория продукта:
Прямой заказ: прямой
Другое: другое
Описание продукта: описание продукта Октябрь Даты: 1 ноября Даты: 19 декабря Даты: 24
Мощность: Да
Мощность: Для захвата мира
Разрешение на веб-сайт: Нет
Информация для выдачи:
Ознакомьтесь с правилами: Подпись