| | |
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 |
# .htaccess 5.2.10 ajax apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date display dissertation dynamic echo email error file files folder form forms function functions google href htaccess html image images include insert integration ip java javascript joomla ldap legislation limit link local login loop mail memberships menu mlm mod_rewrite multiple mysql mysqlquery oop open paypal pdf persist php problem query radio random recursion regex remote script search server sessions sms soap sockets source space spam sql syntax system table tutorial update upload url validation validator variable video web xml youtube






