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

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

PHP 5/MySQL Programming- P23: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 | 88 Returning to the Petals Game PHP 5 MySQL Programming for the Absolute Beginner At the beginning of this chapter I show you the Petals Around the Rose game. This game uses all the skills you have learned so far including the new concepts from this chapter. If you haven t already done so play the game now so you can see how it works. Here s the basic plan of the Petals game Each time the page is drawn it randomly generates five dice and calculates the correct number of petals based on a supersecret formula. The page includes a form that has a text area called guess for the user to enter the answer. The form also includes a hidden field called numPetals which tells the program what the correct answer was. Can t the program remember the right answer Since the program generated the correct answer in the first place you might be surprised to learn that the right answer must be hidden in the Web page and then retrieved by the same program that generated it. Each contact between the client and the server is completely new. When the user first plays the game the page is sent to the browser and the connection is completely severed until the user hits the submit button. When the user submits the form the Petals program starts over again. It s possible the user plays the game right before he goes to bed then leaves the page on the computer overnight. Meanwhile a hundred other people might use the program. For now use hidden data to help keep track of the user s situation. Later in this book you learn some other clever methods for keeping track of the users situations. The Petals game doesn t introduce anything new but it s a little longer than any of the other programs you ve seen so far. I introduce the code in smaller chunks. All the code is shown in order but not in one long code sample. Look on the CD for the program in its entirety. Starting HTML Like most PHP programs the Petals game uses some HTML to set everything up. The HTML is pretty basic because PHP code .

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.