i have an registration page and user enters his data along with his email address in order to register. when user is registered mail is send to admin and the same user. email of user is taken from reg

<form name="registration" method="post" action="registration.php5">  
      <table align="center" class="style1">
          <tr>
              <td class="style2">
                  Email</td>
              <td class="style2">
                  :</td>
              <td>
                  <input id="Text1" type="text" name="email" /></td>
          </tr>
          <tr>
              <td class="style2">
                  Name</td>
              <td class="style2">
                  :</td>
              <td>
                  <input id="Text2" type="text" name="name" /></td>
          </tr>
          <tr>
              <td class="style2">
                  Department</td>
              <td class="style2">
                  :</td>
              <td>
                  <input id="Text3" type="text" name="department" /></td>
          </tr>
          <tr>
              <td class="style2">
                  Office Phone</td>
              <td class="style2">
                  :</td>
              <td>
                  <input id="Text4" type="text" name="phone"/></td>
          </tr>
          <tr>
              <td class="style2">
                  Alternate Phone</td>
              <td class="style2">
                  :</td>
              <td>
                  <input id="Text5" type="text" name="altphone"/></td>
          </tr>
          <tr>
              <td class="style2">
                  &nbsp;</td>
              <td class="style2">
                  &nbsp;</td>
              <td>
                  &nbsp;</td>
          </tr>
          <tr>
              <td class="style2">
                  &nbsp;</td>
              <td class="style2">
                  &nbsp;</td>
              <td>
                  <input id="submit" type="submit" value="Submit" /></td>
          </tr>
         
      </table>
<?PHP
 
//Database Information
 
$dbhost = "localhost";
$dbname = "reg";
$dbuser = "root";
$dbpass = "";
 
//Connect to database
 
mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());
                     
    
$email = $_POST['email'];
$name = $_POST['name'];    
$department = $_POST['department'];
$phone = $_POST['phone'];
$altphone = $_POST['altphone'];
$vista= $_POST['vista'] ;
$wimba= $_POST['wimba'] ; 
 
                    $query = "INSERT INTO details (email,name,department,phone,altphone,vista,wimba,date1)
                     VALUES('$email','$name','$department','$phone','$altphone','$vista','$wimba',CURDATE())";
                     
                     
                                                  
                                                  
                                $headers .= 'Cc:' . $email . "\r\n"; // here is the problem values of email is not coming and cc cant be send
                                             
                             // $toaddress = ".$email." . ' , '; 
                     
                     $toaddress = "vnag@gtech.edu";
 
$subject = "*** TICKET FROM SITE ***";
 
$mailcontent = "Email Address: ".$email."\n".
"Name : ".$name."\n".
"Department name: ".$department."\n".
"Call back number: ".$phone."\n".
"Alternate phone number: ".$altphone."\n".
"Workshop name: ".$vista."\n".
"Workshop name:\n".$wimba."\n";
 
$fromaddress = "From: ".$email."\n";
              //Please specify your Mail Server - Example: mail.yourdomain.com.
ini_set("SMTP","mail.gtech.edu");
 
// Please specify an SMTP Number 25 and 8889 are valid SMTP Ports.
ini_set("smtp_port","25");
 
// Please specify the return address to use
ini_set('sendmail_from', 'santosh@gmail.com');
//invoke mail() function to send mail
mail($toaddress, $subject, $mailcontent, $fromaddress,$headers);
 
 
 
 
 
 
                       
mysql_query($query) or die(mysql_error());
mysql_close();
// header("location:login_success.php5"); 
 
 
 
foreach($_POST as $key => $val) 
{
    echo $key.": ".$val."<br /><br/>\n"; 
 
}
      
 
         
 
?>

Open in new window

siddharthkoolAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jar3817Commented:
the fifth arg for mail() is additional parameters, not headers.

Add a line before 56 with something like this:

$headers .= $fromaddress;

And then change 56 to this:

mail($toaddress, $subject, $mailcontent,$headers);

This will combine the CC header and the From address  (the from address really is just another header).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
siddharthkoolAuthor Commented:
Awesome!!!!!!!!!!  


thanks a lot bro!!

its working !!!!
0
jar3817Commented:
anytime...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Servers

From novice to tech pro — start learning today.