Đang chuẩn bị liên kết để tải về tài liệu:
PHP 5/MySQL Programming- P50

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

PHP 5/MySQL Programming- P50:computer programming has often been seen as a difficult and arcane skill. Programming languages are difficult and complicated, out of the typical person’s reach. However, the advent of the World Wide Web has changed that to some extent. It’s reasonably easy to build and post a Web page for the entire world to see. The language of the Web is reasonably simple, and numerous applications are available to assist in the preparation of static pages | 223 the first three lines are name instructor s email and password quizName fgets msfp quizEmail fgets msfp quizPwd fgets msfp The master file is opened with read access. The first three lines are unimportant but I must read them to get to the quiz data. Creating an Answer Key I start by generating an answer key from the master file stepping through each question in the file and extracting all the normal variables from it although I m interested only in the correct variable . I then store the correct value in an array called key. At the end of this loop the key array holds the correct answer for each quiz question. step through the questions building an answer key numCorrect 0 questionNumber 1 while feof msfp currentProblem fgets msfp list question answerA answerB answerC answerD correct split currentProblem key questionNumber correct questionNumber end while fclose msfp Chapter 6 Working th Files Checking the User s Response The user s responses come from the HTML form as an array called quest. The correct answers are in an array called key. To grade the test I step through both arrays at the same time comparing the user s response with the correct response. Each time these values are the same the user has gotten an answer correct. The user was incorrect when the values are different or there was a problem with the test itself don t discount that as a possibility. Unfortunately you can t do much about that because the test author is responsible for making sure the test is correct. Still you might be able to improve the situation somewhat by providing a better editor that ensures the test is in the right format and each question has an answer registered with it. 224 PHP 5 MySQL Programming for the Absolute Beginner Check each answer from user for questionNumber 1 questionNumber count quest questionNumber guess quest questionNumber correct key questionNumber correct rtrim correct if guess correct user got it right numCorrect print problem questionNumber was correct

TÀI LIỆU LIÊN QUAN
Đã 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.