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

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

PHP 5/MySQL Programming- P49: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 | 218 PHP 5 MySQL Programming for the Absolute Beginner function buildHTML global quizName quizData htData HERE html head title quizName title head body HERE get the quiz data problems split n quizData htData . HERE center h1 quizName h1 center form action gradeQuiz.php method post Name input type text name student ol HERE questionNumber 1 foreach problems as currentProblem list question answerA answerB answerC answerD correct split currentProblem htData . HERE li question ol type A li input type radio name quest questionNumber value A SanswerA 11 li input type radio name quest questionNumber value B SanswerB li li input type radio name quest questionNumber value C answerC li li input type radio name quest questionNumber value D SanswerD li Chapter 6 Working with Files ol li HERE questi onNumber end foreach ShtData . HERE ol input type hidden name quizName value qui zName input type submit value submit quiz 220 form PHP 5 MySQL Programming for the Absolute Beginner HERE print htData return htData end buildHTML body html Most of the critical information this function needs is stored in quizData. Each line of quizData stores one question so I use a split function to break quizData into an array called problems. A foreach loop steps through each problem. Each problem contains a list of values which is separated into a series of scalar variables with the combination of split and list . Within the foreach loop I also add the HTML code necessary to print the current question s information. Take a careful look at the code for the radio buttons. Recall from your HTML experience or Appendix A that radio buttons that operate as a group should all have the same name. I did this by calling them all quest questionNumber . The questionNumber variable contains the current question number and this value is interpolated before the HTML code is written. Question number 1 has four different radio buttons called quest 1 . The gradeQuiz program sees this as an array called quest. At the

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.