Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

posting the result of a mysql query in a text area using html tags

2:40 pm on Apr 28, 2013 (gmt 0)

New User

joined:Apr 28, 2013
votes: 0

here is the code i am using a wysiwyg for creating the pages
and i inserted the php code



<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Untitled Page</title>

<style type="text/css">



background-color: #FFFFFF;

background-image: url(images/backgroundlou.jpg);

background-repeat: no-repeat;

color: #000000;



<style type="text/css">



color: #0000FF;

text-decoration: underline;




color: #800080;




color: #FF0000;




color: #0000FF;

text-decoration: underline;



<style type="text/css">



border: 1px #C0C0C0 solid;

background-color: #FFFFFF;

color :#000000;

font-family: Arial;

font-size: 13px;

text-align: left;





<textarea name="TextArea1" id="TextArea1" style="position:absolute;left:379px;top:190px;width:592px;height:266px;z-index:0;" rows="15" cols="93"></textarea>


// info to connect to db

$host = 'localhost';
$user = 'ffffff';
$pass = 'ffffff';
$db = 'ffffff';

// connection to DB

$link = mysql_connect ($host,$user,$pass) or die ('Erreur : '.mysql_error() ) ;
mysql_select_db($db) or die ('Erreur :'.mysql_error()) ;

// compting the result and recuparating them
$select = 'SELECT nom,continent,coord FROM test';
$result = mysql_query($select,$link) or die ('Erreur : '.mysql_error() );
$total = mysql_num_rows($result);

// if we get a result we display it in the text area
if($total) {
// start of table
echo '<table bgcolor="#FFFFFF">'."\n";
// first line of the table
echo '<tr>';
echo '<td bgcolor="#669999"><b><u>Continent</u></b></td>';
echo '<td bgcolor="#669999"><b><u>Coord</u></b></td>';
echo '<td bgcolor="#669999"><b><u>Player</u></b></td>';
echo '</tr>'."\n";
// displaying the result
while($row = mysql_fetch_array($result)) {
echo '<tr>';

echo '<td bgcolor="#CCCCCC">'.$row['continent'].'</td>';
echo '<td bgcolor="#CCCCCC">'.$row['coord'].'</td>';
echo '<td bgcolor="#CCCCCC">'.$row['nom'].'</td>';
echo '</tr>'."\n";
echo '</table>'."\n";
// fin du tableau.
else echo 'Pas d\'enregistrements dans cette table...';

// on libère le résultat




i am a total newb when it comes to php i have this code working it used to call its own html page but i want to display the table in a text area and i have no clue
11:13 am on Apr 29, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member swa66 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 7, 2003
votes: 0

to display the table in a text area

You cannot put a html table in a textarea.

The solution is to make a form surrounding the table and to have each field an individual editable input field, and upon submission process it all.
Or better yet: use ajax to just send the modified fields as they are modified.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members