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

$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 > 
  <td> Complaint NO. :- $data[0]</br></br></td>   
  <td> NAME :-   $data[1]</br></br>   
  <td> DEPARTMENT :-  $data[2] </br></br>  
  <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>
$to = "";
 $subject = "user complaint!";
 $massage = "$result";
 if (mail($to, $subject, $massage)) {
   echo("<p>Message successfully sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");

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.

$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"; 


$to = "";  
$subject = "User Complaint"; 
$email = $_POST['Email'] ;  
$message = $_REQUEST['Name'] ; 

$sent = mail($to,$subject,$email, $message) ;  
{print "Your mail was sent successfully"; } 
{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.