TAILIEUCHUNG - PHP 5 Recipes A Problem-Solution Approach 2005 phần 9

Có hai cấp độ người sử dụng trong PHP 4, một cấp là biết điều này, cấp độ kia thì không. Những người thuộc cấp độ thứ hai thường không để ý đến vấn đề này và trong mã nguồn mà họ viết cũng cho thấy là họ không hề quan tâm đến liệu điều đó có tồn tại hay không. | 498 13-5 REDISPLAYING FORMS WITH PRESERVED INFORMATION AND ERROR MESSAGES Selection select name myselection option value nogo make a selection. option option value 1 php if _POST myselection 1 selected selected php Choice 1 option option value 2 php if _POST myselection 2 selected selected php Choice 2 option option value 3 php if _POST myselection 3 selected selected php Choice 3 option select br br Your Email input type text name youremail maxlength 150 -value php echo _POST youremail br input type submit value Submit style margin-top 10px form php div body html Figure 13-1 shows the potential output if you input a valid name field but leave the selection and e-mail address empty. Please make a selection. Please enter a valid e-mail address. Example Your Name Lee Babin Selection make a selection. V Your E-mail I Submit I Figure 13-1. Telling users to properly enter information How It Works In this example you have seen how you may want to handle your validation. Keep in mind that your objective is to ensure that users know what they did wrong and keep their properly submitted information for ease of use. To ensure that the user of this form sees the error messages the Cascading Style Sheet CSS class called error will be used every time an error message is displayed. The error message will display in bold and red thus directing the users to realize what they did wrong. By providing the value fields and in the case of the select box a selected argument if you have valid data the form fields will retain any current proper information. If there is no current proper data to use nothing will display. This form has now become decidedly easy to use is quite secure and ensures a happy well-directed user. 13-6 PREVENTING MULTIPLE SUBMISSIONS ON THE SERVER SIDE 499 Preventing Multiple Submissions of a Form One possible occurrence that happens often is that users become impatient when waiting for your script to do what it is doing and hence they click the submit button on a

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.