PHP and MySQL Web Development - P27

PHP and MySQL Web Development - P27: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | Formatting Strings 97 Listing Continued head title Bob s Auto Parts - Feedback Submitted title head body h1 Feedback submitted h1 p Your feedback has been sent. p body html Note that generally you should check that users have filled out all the required form fields using for example isset .We have omitted this from the script and other examples for the sake of brevity. In this script you ll see that we have concatenated the form fields together and used PHP s mail function to email them to feedback@ haven t yet used mail so we will discuss how it works. Unsurprisingly this function sends email. The prototype for mail looks like this bool mail string to string subject string message string additional_headers string additional_parameters The first three parameters are compulsory and represent the address to send email to the subject line and the message contents fourth parameter can be used to send any additional valid email email headers are described in the document RFC822 which is available online if you want more details. RFCs or Requests for Comment are the source of many Internet standards we will discuss them in Chapter 17 Using Network and Protocol Functions. Here we ve used the fourth parameter to add a From address for the can also use to it add Reply-To and Cc fields among others. If you want more than one additional header just separate them by newlines n within the string as follows additional_headers From webserver@ n . Reply-To bob@ The optional fifth parameter can be used to pass a parameter to whatever program you have configured to send mail. In order to use the email function set up your PHP installation to point at your mail-sending program. If the script doesn t work for you in its current form doublecheck Appendix A Installing PHP 4 and MySQL. Through this chapter we ll enhance this basic script by making use of PHP s string handling and regular expression functions.

Không thể tạo bản xem trước, hãy bấm tải xuống
45    18    2    31-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.