93
معالجة أفضل للنماذج
البرنامج النصي form1.php (تابع)
41.
} // end function print_form
42.
43.
function check_form() {
44.
45.
46.
global $error, $print_again, $first, $last;
$error['first'] = false;
$error['last'] = false;
47.
$print_again
= false;
48.
49.
50.
= true;
51.
}
52.
53.
54.
= true;
55.
}
56.
57.
58.
59.
60.
}
61.
62.
63.
64.
65.
66.
67.
if($first == "") {
$error['first'] = true;
$print_again
if ($last == "") {
$error['last'] = true;
$print_again
if ($print_again) {
print_form();
} else {
print("<h3>Thank you for completing the form!</h3>");
} // end function check_form
/***** MAIN ***** /
if (isset($submit)) {
check_form();
} else {
print_form();
68.
}
69.
?>
70.
</body>
71. </html>
ص٩٣