| | |
how to save TAB delimited list
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2005
Posts: 92
Reputation:
Solved Threads: 0
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.
when I retrieve from DB, it shows:
P.S. The DB field is TEXT datatype (I use MSSQL)
Thanks in advance.
PHP Syntax (Toggle Plain Text)
test test test <----regular space ============== test test test <----one TAB space test test test <----two TAB spaces
when I retrieve from DB, it shows:
PHP Syntax (Toggle Plain Text)
test test test ============== test test test test test test
P.S. The DB field is TEXT datatype (I use MSSQL)
you could try:
php Syntax (Toggle Plain Text)
str_replace(" ", "\t" $string);
Last edited by R0bb0b; Jun 20th, 2008 at 2:13 pm.
You can also use <pre> tag.
http://www.w3schools.com/TAGS/tag_pre.asp
Just did a quick check to see if it works and it does..
http://www.w3schools.com/TAGS/tag_pre.asp
php Syntax (Toggle Plain Text)
<?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>"; } } ?>
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
I think that doesn't work..
Last edited by nav33n; Jun 20th, 2008 at 2:26 pm.
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
Other Threads in the PHP Forum
- Previous Thread: Please help in coding
- Next Thread: Form in one iFrame refreshes another iFrame
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external fcc file files folder form forms forum freelancing function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction menu method mlm mod_rewrite multiple mysql neutrality oop pageing pagerank paypal pdf php phpmysql play problem query question radio random recursion remote root script search select server sessions sms soap source space sql support! syntax system table template tutorial update upload url validator variable video web youtube






