here is my updated code ;
in beginning section :
header('Content-Type: application/msexcell');
header('Content-Disposition: inline; filename=data.xls');
in body section :
if($ss=='state' && $ss==''){
$view1="select id, name,address,phone,state from user_data
where state='$st'";
if(!$result1=mysql_query($view1,$dbh))
{
echo mysql_error();
exit;
}
while ($row1=mysql_fetch_array($result1)){
echo "<hr width=95% align=left>";
echo "<table border=1 cellpadding=0 cellspacing=0 width=95% bgcolor=cecece>";
echo "<tr><td><b>User Data<b></td></tr>";
echo "</table><br>";
echo "<table border=0 cellpadding=0 cellspacing=0 width=95% >";
echo "<tr>";
echo "<td width=20%><font face=arial,helvetica,sans-serif size=-2><b>id Number</b></td>";
echo "<td width=80%><font face=arial,helvetica,sans-serif size=-2>: \"".$row1[id]."\"</td>"; // i had quoted the id number
echo "<tr>";
echo "<td width=20%><font face=arial,helvetica,sans-serif size=-2><b>Name</b></td>";
echo "<td width=80%><font face=arial,helvetica,sans-serif size=-2>: $row1[name]</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=20%><font face=arial,helvetica,sans-serif size=-2><b>Address</b></td>";
echo "<td width=80%><font face=arial,helvetica,sans-serif size=-2>: $row1[address]</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=20%><font face=arial,helvetica,sans-serif size=-2><b>Phone</b></td>";
echo "<td width=80%><font face=arial,helvetica,sans-serif size=-2>: $row1[phone]</td>";
echo "<tr>";
echo "<td width=20%><font face=arial,helvetica,sans-serif size=-2><b>state</b></td>";
echo "<td width=80%><font face=arial,helvetica,sans-serif size=-2>: $row1[state]</td>";
echo "</tr>";
echo "<tr>";
echo "</table><br>";
}
anything wrong with my coding?
how can i use php to automatically format the cell to text before the data being transferred to excell ?