Jump to content

Barand

Moderators
  • Posts

    24,612
  • Joined

  • Last visited

  • Days Won

    834

Everything posted by Barand

  1. Are those recommended from personal experience, or are they to be avoided at any cost? And if the first is that good, why did you switch to the others?
  2. Having read this topic: http://www.phpfreaks.com/forums/index.php/topic,155323.0.html I wouldn't go with GoDaddy
  3. Take the text straight from a text area, complete with newlines and save in db field. OK, you need to addslashes, remove html tags but basically normal text in the db, or maybe text in a text file. if you are outputting to page body text, use nl2br() to show line breaks. If it goes into a textarea for edit, don't use nl2br() Demo script:- <?php if (isset($_GET['sampletext'])) { echo "<h4>With newlines only</h4>"; echo $_GET['sampletext']; echo "<h4>Using nl2br()</h4>"; echo nl2br($_GET['sampletext']); echo "<hr>"; } ?> <HTML> <HEAD> <meta Name="generator" content="PHPEd Version 3.1.2 (Build 3165)"> <title>Text area sample</title> </HEAD> <BODY> <FORM method="GET"> <p>Type some text with linebreaks<br> and submit</p> <TEXTAREA name="sampletext" rows="5" cols="30"><?=$_GET['sampletext']?></TEXTAREA> <br> <INPUT TYPE="SUBMIT" value="Submit text"> </FORM> </BODY> </HTML>
  4. I would argue that it is better to store the text in the DB with the '\n' rather than using nl2br(). If you want to redisplay the text in a textarea for editing, you want the newlines but not the '<br/>' Use nl2br when you want to display the text containing newlines in the body of a page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.