// print_r($_POST); if ($_SERVER["REQUEST_METHOD"] == "POST") { $email = validatestrings($_POST["email"]); $first_name = validatestrings($_POST["first_name"]); $last_name = validatestrings($_POST["last_name"]); $address1 = validatestrings($_POST["address1"]); $address2 = validatestrings($_POST["address2"]); $city = validatestrings($_POST["city"]); $state = validatestrings($_POST["state"]); $zip_code = validatestrings($_POST["zip_code"]); $country = validatestrings($_POST["country"]); $phone = validatestrings($_POST["phone"]); $allow = validatestrings($_POST["allow"]); $style = validatestrings($_POST["style"]); $level = validatestrings($_POST["level"]); $color = validatestrings($_POST["color"]); if ($valid) { $new_line = "\n"; $new_line .= "{$email}, {$first_name}, {$last_name}, {$address1}, {$address2}, {$city}, {$state}, {$zip_code}, {$country}, {$phone}, {$allow}, {$style}, {$level}, {$color}"; file_put_contents("clubList.csv", $new_line, FILE_APPEND); } } $file = file_get_contents("clubList.csv"); $quilt_rows = str_getcsv($file, "\n"); ?> <!DOCTYPE html> <html> <head> <metacharset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Form Block of the Month Aplication</title>
global $valid; //convert possiblr malicious code to safe code $str = htmlspecialchars($str); //trim empty spaces start and end $str = trim($str); if (empty($str) && $required) { $valid = false; } return $str; } // print_r($_POST); if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = validatestrings($_POST["name"]); $email = validatestrings($_POST["email"]); $phone = validatestrings($_POST["phone"]); $message = validatestrings($_POST["message"]); if ($valid) { $new_line = "\n"; $new_line .= "{$name}, {$email}, {$phone}, {$message}"; file_put_contents("contact.csv", $new_line, FILE_APPEND); } } $file = file_get_contents("contact.csv"); $label_rows = str_getcsv($file, "\n"); ?> <!DOCTYPE html> <html> <head>