Hi. I'm a relative newcomer to the world of php, and I keep bumping into a problem with a mail () form. I need to send an automatic email to two addresses, but I can't seem to get it to work. One email address works just fine, but I can't get the email sent to two different addresses no matter what I try. Below is my code. If someone could help me spot my errors, I'd appreciate it. Thanks!
Code from actual page:
Code from actual page:
Code:
<?php //Check if the form has been submitted. if ( isset ($_POST['submit'])) { $problem = FALSE; //Check for each value. if (empty ($_POST['email2'])) { $problem = TRUE; print '<p>Please enter your email address!</p>'; } } //Display the form. print '<form action="handle_requests.php" method="post"><p>'; print 'Email Address: <input type="text" name="email2" size="20" ' . $_POST['email2'] . '" /> <br />'; print '<input type="submit" name="submit" value="Submit Email Address" /></p> </form>'; // Complete the HTML formatting stuff. print '</div>'; ?> [B]Code from handle_requests page[/B]: <html> <head> <title>Request for E-mail Updates Successful!</title> </head> <body> <?php // Script to handle e-mail requests for updates. //Address error handing. ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); // In case register_globals is disabled. $email2 = $_POST['email2']; print '<p>Your request for e-mail updates has been successful! You will be receiving a e-mail confirmation shortly.</p>'; $body = "Thank you for requesting updates. Periodically, we will be sending you information about new material on our website, new publications, and upcoming events. You have registered with the following address: {$_POST['email2']}."; mail ($_POST['[B]email2, address@email.com[/B]'], 'Email Confirmation', $body, 'From: address@email.com'); ?> </body> </html>
Comment