$email = test_input($_POST["email"]);if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "Email xato yozildi"; }
$website = test_input($_POST["website"]);if (!preg_match("/\b(??:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) { $websiteErr = "Invalid URL"; }
<?php// massiv$nameErr = $emailErr = $genderErr = $websiteErr = "";$name = $email = $gender = $comment = $website = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["name"])) { $nameErr = "Nomini yozing"; } else { $name = test_input($_POST["name"]); // nomni tekshirish if (!preg_match("/^[a-zA-Z ]*$/",$name)) { $nameErr = "Faqat harf va belgilangan simvollar"; } } if (empty($_POST["email"])) { $emailErr = "Email yozish kerak"; } else { $email = test_input($_POST["email"]); // email togri formatdaligini tekshiramiz if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "Email xato"; } } if (empty($_POST["website"])) { $website = ""; } else { $website = test_input($_POST["website"]); // URLni tekshirish if (!preg_match("/\b(??:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) { $websiteErr = "URL notogri"; } } if (empty($_POST["comment"])) { $comment = ""; } else { $comment = test_input($_POST["comment"]); } if (empty($_POST["gender"])) { $genderErr = "Jins tanlang"; } else { $gender = test_input($_POST["gender"]); }}?>
« Mavzuga qaytish