Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
PHP 5/MySQL Programming- P16: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 | 53 I made this program as simple as possible because I didn t expect to need it for long. It s simply a table with the name of each variable and its associated value. I did it this way to ensure that I get all the variables exactly the way I want them. There s no point in building the story if you don t have the variables working. Building the Final Story The story itself is very simple to build if you ve planned and ensured that the variables are working right. All I had to do was write out the story as it was written in the plan with the variables incorporated in the appropriate places. Here s the code for the finished story.php page html head title Little Boy Who title head body center h1 Little Boy Who h1 print HERE h3 Little Boy color come blow your instrument br The anim1 s in the place the anim2 s in the vegetable. br Where s the boy that looks after the anim3 br He s under the structure action. h3 HERE center body html Chapter 2 Using Variables and Input It might astonish you that the final program is quite a bit simpler than the test program. Neither is very complicated but once you have created the story set up 54 PHP 5 MySQL Programming for the Absolute Beginner the variables and ensured that all the variables are sent correctly the story program itself turns out to be almost trivial. Most of the story.php code is plain HTML. The only part that s in PHP is one long print statement which uses the print HERE syntax to print a long line of HTML text with PHP variables embedded inside. The story itself is this long concatenated text. Summary In this chapter you learn some incredibly important concepts what variables are and how to create them in PHP how to connect a form to a PHP program with modifications to the form s method and action attributes and how to write normal links to send values to server-side scripts. You built programs that respond to various kinds of input elements including drop-down lists radio buttons and list boxes. You went through the