PHP 5/MySQL Programming- P59

PHP 5/MySQL Programming- P59: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 | 268 PHP 5 MySQL Programming for the Absolute Beginner Building Select Objects The select object is derived from an associative array. It expects a name for the entire structure and an associative array. For each element in the associative array the index is translated to the value property of an option object. Also the value of the array element becomes the text visible to the user. function gSelect name listVals given an associative array prints an HTML select object Each element has the appropriate value and displays the associated name temp temp . select name name n foreach listVals as val desc temp . option value val desc option n end foreach temp . select n return temp end gSelect function select name listVals this- addText this- gSelect name listVals end buildSelect Responding to Form Input One more SuperHTML object method quickly produces a name value pair for each element in the _REQUEST array. In effect this returns any form variables and their associated values. function formResults returns the names and values of all form elements in an HTML table this- startTable foreach _REQUEST as name value this- tRow array name value end foreach this- endTable end formResults 269 end class def Summary This chapter introduced to the basic concepts of object-oriented programming. You saw that objects incorporate properties and methods. You learned how objects implement inheritance polymorphism and encapsulation. You experimented with the SuperHTML class and learned how to expand it when creating your own useful and powerful object classes. CHALLENGES 1. Rewrite one of your earlier programs using the SuperHTML object. 2. Add support for more HTML tags in the SuperHTML class. 3. Create an extension of SuperHTML that has a custom header reflecting the way you begin your Web pages. 4. Add support for checkboxes and radio buttons. 5. Improve the buildTable method so it automatically makes the first row or column a parameter-based header. 6. Rewrite an earlier program with

Không thể tạo bản xem trước, hãy bấm tải xuống
219    23    1    24-03-2023
4    21    1    24-03-2023
Đã 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.