TAILIEUCHUNG - The Essential Guide to Dreamweaver CS4 with CSS, Ajax, and PHP phần 9

Trong chương này, chúng tôi sẽ có quá trình giai đoạn tiếp theo của nó bằng cách chứng thực dữ liệu ở phía máy chủ Sau đó khóa học sụp đổ, tôi hy vọng bạn cảm thấy không giống như một nạn nhân vụ tai nạn nhưng sinh lực và raring để đi. | HANDLING CHECKBOX GROUPS SEARCHES AND DATES 9. Remove the square brackets after operating_system in _POST operating_ system line 41 in the preceding screenshot so that it looks like this GetSQLValueString _POST operating_system text This inserts the value of _POST operating_system into the table as a string but the values being sent from the checkbox group are an array. So they need to be reformatted before they can be inserted into the database. 10. To convert the array in _POST operating system into a comma-separated string add the following code block highlighted in bold immediately after the code shown on line 39 in the preceding screenshot if isset _POST MM_insert _POST MM_insert form1 convert the checkbox group subarray to a string if isset _POST operating_system _POST operating_system implode _POST operating_system else _POST operating_system none insertSQL sprintf INSERT INTO os_poll operating_system VALUES s The block is enclosed in the server behavior s conditional statement that executes the code only if the form has been submitted. Because checkboxes and multiplechoice lists don t appear in the _POST array if nothing has been selected the new code first checks whether any values have been selected for operating_system. If they have they are converted to a comma-separated string with implode . Otherwise none is assigned as the value. This is needed to prevent the SQL query from throwing an error. The first argument to the implode function is the string you want to act as a separator between array elements. It s vital to use a comma with no space on either side like this _POST operating_system implode _POST operating_system If you add a space after the comma inside the first argument only the first value is inserted in the SET column. This is because the space is treated as part of the string. The extra space after the first comma in the following line of code will result in incomplete data being inserted into the SET column _POST operating_system implode

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.