Web hosting domain names - PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY 2.

PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY 2. In the code that processes the message, set a default value for a multiple-choice list in the same way as for an array of check boxes. $interests = isset($interests) ? $interests : array(’None selected’); $characteristics = isset($characteristics) ? $characteristics : . array(’None selected’); 3. When building the body of the message, use a foreach loop to iterate through the subarray, or use implode() to create a comma-separated string like this: $message .= ‘Characteristics associated with Japan: ‘.implode(’, ‘, . $characteristics); A complete script using all form elements is in contact10.php in the download files for this chapter. Redirecting to another page Throughout this chapter, everything has been kept within the same page, even if the message is sent successfully. If you prefer to redirect the visitor to a separate acknowledgment page, locate this section of code at the end of the message processing section: // send it $mailSent = mail($to, $subject, $message, $additionalHeaders); if ($mailSent) { // $missing is no longer needed if the email is sent, so unset it unset($missing); } } } Change it like this: // send it $mailSent = mail($to, $subject, $message, $additionalHeaders); if ($mailSent) { // redirect the page with a fully qualified URL header(’Location: http://www.example.com/thanks.php’); exit; } } } The HTTP/1.1 protocol stipulates a fully qualified URL for a redirect command, although most browsers will perform the redirect correctly with a relative pathname. When using the header() function, you must be very careful that no output is sent to the browser before PHP attempts to call it. If, when testing your page, you see an error message warning you that headers have already been sent, check there are no new lines or
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Leave a Reply