I try to copy and paste TAB delimited list into html text area, then save it to database, however when I retrieve it from DB, all TAB space are gone, does anyone can give me advice is there a way to keep these TAB?
Thanks in advance.

test     test     test                       <----regular space
==============
test	test	test                            <----one TAB space
test		test		test            <----two TAB spaces

when I retrieve from DB, it shows:

test test test
==============
test test test
test test test

P.S. The DB field is TEXT datatype (I use MSSQL)

You can also use <pre> tag.
http://www.w3schools.com/TAGS/tag_pre.asp

<?php
mysql_connect("localhost","root");
mysql_select_db("test");
if(isset($_POST['submit'])) {
	mysql_query("insert into tst (name) values ('".$_POST['tarea']."')");
}
?>
<html>
<body>
<form method="post">
<textarea name="tarea" cols="30" rows="20"></textarea>
<input type='submit' name="submit" value="submit">
</form>
</body>
</html>
<?php
$q = "select * from tst";
$r = mysql_query($q);
if(mysql_num_rows($r) > 0 ) {
while($row = mysql_fetch_array($r)) {
	echo "<pre>";
	echo $row['name'];
	echo "</pre>";
	echo "<br>";
}
}
?>

Just did a quick check to see if it works and it does..

This article has been dead for over six months. Start a new discussion instead.