I am working on the form in which you fill out the whole PHP form and e mail that details to someone. It is working fine. But now i want to send the same form to be sent to different people and user should be able choose the check boxes to whom they want to send e mail to.
I write some code simple If else conditions but i think i am making some mistakes. Because when i tried - it is not sending them e mails.
Here is my code. I have 2 files. 1 is the HTML form and second is the PHP files.
HTML FORM:----------------------I put the check boxes. - I want the user to choose the check boxes to whom user want to send E mail.
Expand|Select|Wrap|Line Numbers
- <td><strong>E mail Send to:</strong> </td>
- <td colspan="2">
- <input name="send" type="checkbox" value="Harsh">
- Harsh
- <input name="send" type="checkbox" value="Abbey">
- Abbey
- <input name="send" type="checkbox" value="Michelle">
- Michelle
- </td>
Expand|Select|Wrap|Line Numbers
- <?php
- $subject = "Catch of the Week- Name--".$_POST["Name"]."\n";
- $message = ' Employee Firstname--'.$_POST["employee_firstname"]."\n".' Employee Lastname--'.$_POST["employee_lastname"]."\n".'Work Area--'.$_POST["work"]."\n".' Nominated For--'.$_POST["nominated"]."\n".'Comments--'.$_POST["comments"]."\n".' Name of Sender--'.$_POST["Name"]."\n".'Address--'.$_POST["Address"]."\n".'Phone Number--'.$_POST["phone_number"]."\n";
- $headers = 'From: webmaster@' . $_SERVER['SERVER_NAME'] . "\r\n" .
- 'Reply-To: webmaster@' . $_SERVER['SERVER_NAME'] . "\r\n" .
- 'X-Mailer: PHP/' . phpversion();
- if($subject)
- {
- elseif($send == "Harsh")
- {
- mail("hpandya@csufresno.edu", $subject, $message, $headers);
- }
- elseif($send == "Abbey")
- {
- mail("hnpandya2002@yahoo.com", $subject, $message, $headers);
- }
- elseif($send == "Michelle")
- {
- mail("", $subject, $message, $headers);
- }
- elseif($send == "Harsh")
- {
- mail("housingwebmaster@listserv.csufresno.edu", $subject, $message, $headers);
- }
- echo "Thank you for nominating a staff member for our Catch of Week Drawing. Winners are drawn every Friday. You can check Housing Happenings for a list of the winners, and who nominated them. If your nomination form is complete and drawn, you win a Movie Ticket.";
- }
- else
- echo "failed";
- ?>
__________________________________________________ ______
I have added HARSH - ABBEY and MIchelle - as check boxes but its not working when i submit. Remember it was working for only one person so when i added multiple people it is not working so the problem might be in IF Else conditions.
Thanks,
Please Help - I would Appreciate it.
Harsh
(I would never give up.....)