hi guys
I want to have a text area that get more height eachtime I press enter and make the text longer I saw that on phpmyadmin.
and also when I add the text on mysql I see that it puts all text in one line why that happens and how to fix it?
I used text on sql code for it's row.
thanks sarah.
textarea problems
Moderator: General Moderators
Re: textarea problems
This is a javascript issue. Not PHP.
Re: textarea problems
Moved to Client Side.
To answer your questions:
1) You could add a javascript listener to the textarea & every time [enter] is typed, grow the height of the textarea by 1 em. A textarea might have special properties such as the # of lines it's text has too - don't know though.
2) Your second question leads to more questions. What is being "added" to mysql? Where are you adding it from? How are you looking at the data & not seeing it broken on multiple lines. Note that HTML is pretty much white-space agnostic - any newline characters in the code won't appear as newlines on the page - this applies to phpMyAdmin as well.
To answer your questions:
1) You could add a javascript listener to the textarea & every time [enter] is typed, grow the height of the textarea by 1 em. A textarea might have special properties such as the # of lines it's text has too - don't know though.
2) Your second question leads to more questions. What is being "added" to mysql? Where are you adding it from? How are you looking at the data & not seeing it broken on multiple lines. Note that HTML is pretty much white-space agnostic - any newline characters in the code won't appear as newlines on the page - this applies to phpMyAdmin as well.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: textarea problems
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
thanks pickle
for more information I got something useful
the text have lines when I try to edit them on the form I added them
but on the page that I want to view them the lines are gone!
so the problem should be there when I call them from mysql
it's a function on functions.php
code is this
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
thanks pickle
for more information I got something useful
the text have lines when I try to edit them on the form I added them
but on the page that I want to view them the lines are gone!
so the problem should be there when I call them from mysql
it's a function on functions.php
code is this
Code: Select all
//------Show Intro
function show_intro(){
require("config.php");
mysql_connect($sqlhost,$sqluser,$sqlpass);
mysql_select_db($sqldb);
$sqlsel = "SELECT * FROM intro";
$result = mysql_query($sqlsel) or die(mysql_error() . "<br>Could not select news.");
$r = mysql_fetch_array($result);
$I_title=$r[subject];
$I_text=$r[intro];
echo "
<h1>$I_title</h1>";
echo $I_text;<--this One is my problem-->
}
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Re: textarea problems
Like I said, newline characters are not interpreted in HTML. If $I_text contains newlines, they will not have any effect in a web page. If you want newline characters to do something, you'll need to wrap $I_text in <pre></pre> tags.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.