homepage Welcome to WebmasterWorld Guest from 54.161.192.130
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

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



 
Msg#: 4568695 posted 2:40 pm on Apr 28, 2013 (gmt 0)

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

<html>

<head>

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

<title>Untitled Page</title>



<style type="text/css">

body

{

background-color: #FFFFFF;

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

background-repeat: no-repeat;

color: #000000;

}

</style>

<style type="text/css">

a

{

color: #0000FF;

text-decoration: underline;

}

a:visited

{

color: #800080;

}

a:active

{

color: #FF0000;

}

a:hover

{

color: #0000FF;

text-decoration: underline;

}

</style>

<style type="text/css">

#TextArea1

{

border: 1px #C0C0C0 solid;

background-color: #FFFFFF;

color :#000000;

font-family: Arial;

font-size: 13px;

text-align: left;

}

</style>

</head>

<body>

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

<body>
<?php

// 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
mysql_free_result($result);

?>

</body>

</html>

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

 

swa66

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



 
Msg#: 4568695 posted 11:13 am on Apr 29, 2013 (gmt 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved