Ajax php/mysql reply into html table

Hi Guys,

I'm working in a php/mysql environment. I have a page where I enter a zip code and using ajax it should display the salesman's name and phone.

in my php file I am sending the results back using:

 echo "<tr>";
 echo  "<td>". $row->Name ."</td></tr>";
 echo  "<tr><td>".$ row->Cell_Phone ."</td></tr>";

when I get it back from the php file I am inserting it into a div with an id=Nametxt, and into a text field  id=Email  using:


document.getElementById('Nametxt').innerHTML=data;      
      
$("#Email").val(data);


RESULTS

The div shows:                Dave Brown888-452-7899

The text field shows this:         <td>Dave Brown</td></tr><tr><td>888-452-7899</td></tr>

Why doesn't the table show correctly in the div?


I want it to be:                Dave Brown
                                       888-452-7899
jws2bayAsked:
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.

Dave BaldwinFixer of ProblemsCommented:
"<td>Dave Brown</td></tr><tr><td>888-452-7899</td></tr>" is not a complete table therefore it won't format like one.  This is the minimum you need.
<table><tr><td>Dave Brown</td></tr><tr><td>888-452-7899</td></tr></table>

Open in new window

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
jws2bayAuthor Commented:
Man...I hate tripping over the obvious.   It works.

Thanks for the help

Have a great day
0
Dave BaldwinFixer of ProblemsCommented:
You're welcome, glad to help.
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
Programming

From novice to tech pro — start learning today.