How to send user detail page to my email.with full deatils

<?php
mysql_connect("localhost","root","");
mysql_select_db("Users");
$mysql_query =("SELECT uid,`Name`,Department,Problem,Ext_no,Ip_Add,Remark,Email FROM entryform ORDER BY entryform.uid DESC limit 1 ");
$result = mysql_query($mysql_query);
while($data = mysql_fetch_row($result)){
  echo(" <td > 
  <tr>
  <td> Complaint NO. :- $data[0]</br></br></td>   
  <td> NAME :-   $data[1]</br></br>   
  </td> 
  <td> DEPARTMENT :-  $data[2] </br></br>  
  </td>
  <td> PROBLEM :-$data[3] </br></br> </td>
  <td> EXT. NO.. :  $data[4]</br></br> </td>
  <td> IP ADDRESS :- $data[5] </br></br> </br>
  <td> REMARK :- $data[6] </br></br> </br>
  <td> Mail ID :-           $data[7] </br></br> </br>
  </td>
  </tr>
  ");
}
$to = "support.kaizen@rpr.jspl.com";
 $subject = "user complaint!";
 $massage = "$result";
 if (mail($to, $subject, $massage)) {
   echo("<p>Message successfully sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  } 
?>

Recommended Answers

All 7 Replies

I like your post , quite informative , well post your first one is

Instead of echo'ing to standard output, you should capture this info in a variable (add it to $massage).

please any one help and correct this code for me??

Have you tried what I said ? If so, please show your new code and we'll help you fix it.

Hear is my code .there is a problem only show 1 field (name). iwant to display all filds in my mail page.

<?php 
$con = mysql_connect("localhost","root",""); 
if (!$con) 
  { 
  die('Could not connect: ' . mysql_error()); 
  } 

mysql_select_db("users", $con); 

$sql="INSERT INTO entryform (Name, Department, Problem, Ext_no, Ip_Add, Remark, Email) 
VALUES ('$_POST[Name]','$_POST[Department]','$_POST[Problem]','$_POST[Ext_no]','$_POST[Ip_Add]','$_POST[Remark]','$_POST[Email]')"; 

if (!mysql_query($sql,$con)) 
  { 
  die('Error: ' . mysql_error()); 
  } 
  echo "Your Information Was Successfully Posted"; 


mysql_close($con); 

$to = "Support.kaizen@rpr.jspl.com";  
$subject = "User Complaint"; 
$email = $_POST['Email'] ;  
$message = $_REQUEST['Name'] ; 

$sent = mail($to,$subject,$email, $message) ;  
if($sent)  
{print "Your mail was sent successfully"; } 
else  
{print "We encountered an error sending your mail"; } 
?>

You should build your message:

$message = $_POST['Name'];
$message .= $_POST['Department'];
$message .= $_POST['Problem'];
// and so on
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.