PHP 5/MySQL Programming- P14

PHP 5/MySQL Programming- P14: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 | 43 value pt points br input type radio name sizeType value cm centimeters br input type radio name sizeType value in inches br td tr table input type submit value show me form center body html Chapter 2 Using Variables and Input The page is designed to interact with a PHP program called as you can see by inspection of the action attribute. Note that I added a value attribute for each option element and the radio buttons all have the same name but different values. The value attribute becomes very important when your program is destined to be read by a program. Finally the submit button is critical because nothing interesting happens until the user submits the form. I didn t include checkboxes in this particular example. I show you how checkboxes work in chapter 3 Controlling Your Code with Conditions and Functions because you need conditional statements to work with them. Conditional statements allow your programs to make choices. Reading the Form Elements The program expects input from . When the user submits the HTML form the PHP program produces results like those shown in Figure . In general it doesn t matter what type of element you use on an HTML form. The PHP interpreter simply looks at each element s name and value. By the time the information gets to the server it doesn t matter what type of input element was used. PHP 44 PHP 5 MySQL Programming for the Absolute Beginner FIGURE The code reacts to all the various input elements on the form. automatically creates a variable corresponding to each form element. The value of that variable is the value of the element. The code used in illustrates html head title Your Output title head body h1 Your Output h1 center theStyle HERE border-width borderSize sizeType border-style borderStyle border-color green HERE print div style theStyle print basicText print span center 45 body html In the case of text boxes and

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.