xxx
function render_nahid_enterprise_form() {
$output = '';
// ফর্ম সাবমিট হলে প্রসেস করার অংশ
if ($_SERVER[“REQUEST_METHOD”] == “POST” && isset($_POST[‘nahid_submit’])) {
// ফোল্ডার পাথ
$folder_path = $_SERVER[‘DOCUMENT_ROOT’] . ‘/Application/’;
// ফোল্ডার না থাকলে তৈরি করবে
if (!file_exists($folder_path)) {
mkdir($folder_path, 0755, true);
}
$timestamp = date(“Y-m-d_H-i-s”);
$applicant_name = isset($_POST[‘apply_name’]) ? preg_replace(‘/[^a-zA-Z0-9_]/’, ‘_’, $_POST[‘apply_name’]) : ‘applicant’;
$file_name = $folder_path . “Application_” . $applicant_name . “_” . $timestamp . “.txt”;
$content = “========================================\n”;
$content .= ” NAHID ENTERPRISE – QUOTATION REQUEST\n”;
$content .= ” Submitted Date: ” . date(“Y-m-d H:i:s”) . “\n”;
$content .= “========================================\n\n”;
foreach ($_POST as $key => $value) {
if ($key != ‘nahid_submit’) {
$content .= str_replace(‘_’, ‘ ‘, strtoupper($key)) . “: ” . htmlspecialchars($value) . “\n”;
}
}
// ফোল্ডারে ফাইল সেভ করা
if (file_put_contents($file_name, $content) !== false) {
$output .= ”
“;
} else {
$output .= ”
“;
}
}
// HTML ফর্ম অংশ
$output .= ‘
NAHID ENTERPRISE
Steel Building Manufacturer Contractor
Request for Quotation: Steel Building Materials & Cost Estimation
Whats App and Imo mobile no. 01921053375
Email: nahid.enterprise.bd@gmail.com
‘;
return $output;
}
add_shortcode(‘nahid_application_form’, ‘render_nahid_enterprise_form’);