twilitegxa Posted August 8, 2009 Share Posted August 8, 2009 Is there a way to ensure that if a user types in multiple paragraphs into a textarea field that it displays an indent for each paragraph when it is displayed from the database? Example (typed into textarea field): Serena is the reincarnation of the Princess of the Moon who, in the 30th century, becomes Neo-Queen Serenity of Crystal Tokyo. She is the daughter of Queen Serenity, a kind and loving mother who ruled the entire universe from the Moon Kingdom during the Silver Millennium. Serena transforms into the Justice Fighter Sailor Moon, the leader of all the Sailor Scouts and one of the most powerful as well. Initially Serena refused to accept her role as Sailor Moon, but eventually realized that she could not escape destiny and embraced her responsibility to humankind. Although Serena possesses many qualities unbecoming her status (she is lazy, clumsy, ditzy, gluttonous, and often apathetic), her heart and soul are pure, and she has sacrificed herself many times for others. Serena may drool over any gorgeous guy she meets, but her heart belongs to Darien (known as Prince Darien of Earth during the Silver Millennium). Darien used to tease Serena about her hairstyle by calling her "meatball head", but later uses the nickname as a term of endearment. In 30th century Crystal Tokyo, Serena rules the Earth as Neo-Queen Serenity with her husband, King Darien. Serena attends Crossroads Junior High School, and is in the eighth grade with Amy and Lita. She lives in Azabu Juuban with her mother Ikuko, father Kenji, brother Sammy, and feline confidante and guardian, Luna. Displayed as: Serena is the reincarnation of the Princess of the Moon who, in the 30th century, becomes Neo-Queen Serenity of Crystal Tokyo. She is the daughter of Queen Serenity, a kind and loving mother who ruled the entire universe from the Moon Kingdom during the Silver Millennium. Serena transforms into the Justice Fighter Sailor Moon, the leader of all the Sailor Scouts and one of the most powerful as well. Initially Serena refused to accept her role as Sailor Moon, but eventually realized that she could not escape destiny and embraced her responsibility to humankind. Although Serena possesses many qualities unbecoming her status (she is lazy, clumsy, ditzy, gluttonous, and often apathetic), her heart and soul are pure, and she has sacrificed herself many times for others. Serena may drool over any gorgeous guy she meets, but her heart belongs to Darien (known as Prince Darien of Earth during the Silver Millennium). Darien used to tease Serena about her hairstyle by calling her "meatball head", but later uses the nickname as a term of endearment. In 30th century Crystal Tokyo, Serena rules the Earth as Neo-Queen Serenity with her husband, King Darien. Serena attends Crossroads Junior High School, and is in the eighth grade with Amy and Lita. She lives in Azabu Juuban with her mother Ikuko, father Kenji, brother Sammy, and feline confidante and guardian, Luna. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 8, 2009 Share Posted August 8, 2009 Wrap your paragraphs in <p></p> tags and use the CSS text-indent property Quote Link to comment Share on other sites More sharing options...
twilitegxa Posted August 8, 2009 Author Share Posted August 8, 2009 That doesn't help because the two paragraphs are being pulled from one field in a table in my database. So it is displayed as: $biography Do you see what I'm saying? I have the indent property set for my paragraphs already and I even have the variable wrapped in a paragraph tag: <p>$biography</p> It doesn't fix the second paragraph. I was hoping there was a way through PHP I could set it when I display it, like the strtoupper or something like that? Right now I have: $biography = nl2br($posts_info['biography']); That's why I posted it in the PHP forum. Quote Link to comment Share on other sites More sharing options...
haku Posted August 8, 2009 Share Posted August 8, 2009 The text-indent fixes half your problem. The rest is a php problem, so I'm moving the thread there. Quote Link to comment Share on other sites More sharing options...
twilitegxa Posted August 8, 2009 Author Share Posted August 8, 2009 Thank you. That's where I originally had it. But I figured it out. I used: $biography = ereg_replace("\n", "<p>", $biography ); And also wrapped it in <p></p> and now it works! Quote Link to comment Share on other sites More sharing options...
thebadbad Posted August 8, 2009 Share Posted August 8, 2009 Use str_replace() for simple replacements like that. And shouldn't you replace with '</p><p>' instead of "<p>"? So we end up with valid HTML, you know.. Quote Link to comment Share on other sites More sharing options...
twilitegxa Posted August 8, 2009 Author Share Posted August 8, 2009 Thanks for the suggestion! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.