tailieunhanh - php solutions dynamic web design made easy phần 4

chúng tôi sử dụng tên chỉ trong một biên tập thời trang và vì lợi ích của chủ sở hữu nhãn hiệu hàng hoá,Mặc dù tên phá hoại của nó, imagedestroy () đã không có tác dụng hình ảnh ban đầu, cũng không phải vào hình thu nhỏ đó chỉ được lưu vào trong file. | BRINGING FORMS TO LIFE body is complete it s passed to the wordwrap function which takes two arguments a string and an integer that sets the maximum length of each line. Although most mail systems will accept longer lines it s recommended to limit each line to 70 characters. After the message has been built and formatted the recipient s address the subject line and the body of the message are passed to the mail function. The function returns a Boolean value indicating whether it succeeded in passing the email to the MTA. So it s useful to capture that value as mailSent. You can then use mailSent to redirect the user to another page or change the contents of the current one. 3. For the time being let s keep everything in the same page because the rest of the chapter will add further refinements to the basic script. Scroll down and insert the following code just after the page s main heading new code is highlighted in bold h1 Contact us h1 php if _POST mailSent p class warning Sorry there was a problem sending your message. Please try later. p php elseif _POST mailSent p strong Your message has been sent. Thank you for your feedback. strong p php p Ut enim ad minim veniam . . . p This is a straightforward if. elseif conditional statement but it may look odd if you re not used to seeing scripts that mix XHTML with PHP logic. What s happening can be summarized like this h1 Contact us h1 php if _POST mailSent display a failure message elseif _POST mailSent display an acknowledgment p Ut enim ad minim veniam . . . p 5 As noted before many developers mistakenly think that you need to use echo or print to display XHTML inside a PHP block. It s more efficient to switch back to XHTML except for very short pieces of code. Doing so avoids the need to worry about escaping quotes. Just make sure that you balance your opening and closing braces correctly. 127 PHP SOLUTIONS DYNAMIC WEB DESIGN MADE EASY Both parts of the conditional statement check the Boolean values of _POST and .

TỪ KHÓA LIÊN QUAN