Jump to content

jools619

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Everything posted by jools619

  1. Pikachu2000 - well it works when i used: <select name='department' id='department'> <option value='man1@website.com'>Department 1</option> </select> But when i tried to add in another email address like: <select name='department' id='department'> <option value='man1@website.com, man2@website.com'>Department 1</option> </select> The email form wouldnt send. I thought by putting in another email address, i could send to another person, but i assume the syntax in the option value is wrong? PHP Freak - Yes very true on the spamming aspect, it was usuing this method just to get a basic model working. Although i found this out on the web which was reccommended but no luck: <?php function SendMail( $email_to ) { $personalinjuryEmailArray = array( "man1@website.com", "man2@website.com" ); $credithireEmailArray = array( "man3@website.com" ); switch( $_POST['department'] ){ case "1": foreach ( $personalinjuryEmailArray as $email_to ){ SendMail( $email_to ); } break; case "2": foreach ( $credithireEmailArray as $email_to ){ SendMail( $email_to ); } break; } $email = strip_tags($_POST['email']); $message = "Title: " . strip_tags($_POST['title']) . "\r\n"; $message .= "Name: " . strip_tags($_POST['name']) . "\r\n"; $message .= "Email Address: " . strip_tags($_POST['email']) . "\r\n"; $message .= "Address: " . strip_tags($_POST['address']) . "\r\n"; $message .= "Telephone: " . strip_tags($_POST['telephone']) . "\r\n"; $message .= "Message: " . strip_tags($_POST['comment']) . "\r\n"; $headers = "From: $email\r\n"; $headers .= "Reply-To: $email\r\n"; $subject = "Website Contact Form Enquiry". $subject; if(mail($email_to, $subject, $message, $headers)){ echo 'sent'; } else echo 'failed'; } ?> Is there anyway the first option could work with multiple addresses? Thanks for the replies though guys
  2. Hi Apologies as this may seem like a trival matter, but im new to coding and just need a bit of help.... I have a form which includes a drop down menu of various departments. Depending on which department is chosen, the form is then sent to different people. This is the html code for the drop down: <select name="department" size="1" id="department"> <option value="" selected>Please select</option> <option value="Health & Safety">Health & Safety</option> <option value="Property">Property</option> </select> So for example the first option mails out to mrjones@email.com mrsmith@email.com and the second would go to mrbloggs@emai.com mr@black@email.com and mrwhite@email.com etc... I have a separate php file which gathers the variables so i was thinking an if statement would need to be put into this page? Out of interest i tried something myself and sort of got a result im after: <select name='department' id='department'> <option value='man1@website.com'>Department 1</option> <option value='man2@website.com'>Department 1</option> </select> Then i used $email_to = $_POST['department']; in the php file. But i would like to be able to send to 2 or 3 people so tried: <select name='department' id='department'> <option value='man1@website.com, man2@website.com '>Department 1</option> </select> This didnt work Any help very much appreciated Thanks Jools
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.