Email from PHP Page

Posted on 2011-10-31
Last Modified: 2012-05-12
The attached code works fine. It is part of my PHP page that allows the user to choose an employee name from teh drop down list (employee1, employee2, etc.) & when they submit the form, the employee they chose from teh drop down box gets an email with pieces of information form the form...My question is, is it possible for me to add something to this code so the email address will get CC on the email? I've tried several different ways but can't seem to get it to work. Can someone help me out? Thanks
switch($_REQUEST['employee']) { 
case "Employee1":
$Email = "";
case "Employee2":
$Email = "";
case "Employee3":
$Email = "";
case "Employee4":
$Email = "";
echo "Error, no employee selected!!!";

$Message = "A clerk has entered a 'Date Submitted to Owner'. Please enter/edit this information.\n \n Cust No : ${_REQUEST['pacts']}\n First Name : ${_REQUEST['fname']} \n Last Name : ${_REQUEST['lname']} \n Date Dislosed to Owner : ${_REQUEST['date_disclo_att']} ";	
$Subject  = "A Clerks Has Disclosed a info to the Owner";
$Headers = "From: \n"; 

if (mail($Email, $Subject, $Message, $Headers)) {
echo "<p><center><h2>My Office</h2></center></p>";
echo "<p><h3><center>Eastern District</center></h3></p>";
echo "<center>An email has been sent to the owner."; 
} else { 

echo "This system is not working properly. Please contact IT so they can fix it."; 

Open in new window

Question by:wantabe2
    LVL 21

    Accepted Solution

    Insert the following at line 22:

    $Headers .= "CC: \n";

    Open in new window

    LVL 15

    Author Comment

    That's it! Thanks
    LVL 107

    Expert Comment

    by:Ray Paseur
    CC, Reply-To, BCC, etc. are all parts of the "additional headers" string.  You may find that it is necessary to separate and terminate these with \r\n instead of just \n.

    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    This video teaches users how to migrate an existing Wordpress website to a new domain.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now