TAILIEUCHUNG - PHP and MySQL by Example- P9

Tham khảo tài liệu 'php and mysql by example- p9', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Even though there is only one image when the user clicks somewhere on it the accompanying form will be sent to the server with the location of where the user clicked his or her mouse on the picture that is the pixel coordinates represented as two variables in the PHP script image_name_x and image_name_y image_name is the name assigned to the name attribute of the image input type that is toy_x and toy_y . The actual variable names sent by the browser contain a period rather than an underscore and but as we discussed earlier in this chapter PHP will automatically convert a period or space to an underscore because periods and spaces are not legal characters in PHP variable names. In the following example after the user clicks on any of the check boxes he or she will then click on the picture of the pizza man. This causes the form to be submitted with an array of values selected from the check boxes as well as the x y coordinates of where the user clicked on the image button. Example . Code View The HTML File html head title Image Button title head body bgColor CCFF33 font face verdana b 1 form method post action Pick your pizza p 2 input type checkbox name topping value tomatoes Tomato and Cheese br input type checkbox name topping value salami Salami br input type checkbox name topping value pineapple Pineapple and Ham br input type checkbox name topping value Canadian bacon Canadian bacon br input type checkbox name topping value extra cheese Plain Cheese br p font size -1 Press the pizza man to order br 3 input type image name pizzas src br br input type reset value Clear the form form body html The PHP Script html head title Finding Pixel Coordinates title head body bgcolor 8CCCCA br fieldset legend b Pizza Choices b legend php 4 if _POST topping Please purchase PDF Split-Merge on to remove this watermark. print ul 5 foreach _POST topping as value print li value li print ul print The pixel .

TỪ KHÓA 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.