<textarea .....

Sn00pY
huhu

ich hätte da mal eine frage zu <textarea .....


und zwar wie kann ich machen das wenn einer ein text eingibt und eine neue zeile beginnt ohne <br /> einzugeben aber trotzdem dann im ausgabefeld eine zeile frei ist?

gruß
[kamui]
php:
1:
$text nl2br($text);


Das wandelt alle Zeilenumbrüche in <br />s um.
Sn00pY
wie genau muss ich es einbauen?

hier mal mein textarea:

<textarea rows="24" cols="90" name="berichttext" class="input" style="width:70%;" wrap="off"></textarea>
Schweinebacke
so zum Bleistift.
php:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Symtec Development Studio 1.1">
<title>Document Title</title>
</head>
<body>
<?php

$content $text// Angaben aus dem Textfeld

function format_html($content)
 {
  $content str_replace("\r\n""<br/>"$content);
  return $content ;
 }

echo format_html("$content")

?>
<h1>Textfeld</h1>
<form method=post action="<?php echo $PHP_SELF?>">
  <table border="0" cellpadding="3" cellspacing="0">
      <td><b>Texteingabe</b><br />
    <textarea name="text" cols="50" rows="10"></textarea></td>
    </tr>
    <tr><td>
    <input name="Submit" type="submit" value="Abschicken" /></td>
    </tr>
</table>
</form>
</body>
</html>


für code faule großes Grinsen das geht tatsächlich

php:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Symtec Development Studio 1.1">
<title>Document Title</title>
</head>
<body>
<?php
echo nl2br("$text");
?>
<h1>Textfeld</h1>
<form method=post action="<?php echo $PHP_SELF?>">
  <table border="0" cellpadding="3" cellspacing="0">
      <td><b>Texteingabe</b><br />
    <textarea name="text" cols="50" rows="10"></textarea></td>
    </tr>
    <tr><td>
    <input name="Submit" type="submit" value="Abschicken" /></td>
    </tr>
</table>
</form>
</body>
</html>
[kamui]
php:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
<? foreach($_POST as $key=>$value) ${$key}=$value?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Symtec Development Studio 1.1">
<title>Document Title</title>
</head>
<body>
<?=nl2br($text);?>
<h1>Textfeld</h1>
<form method=post action="<?php echo $PHP_SELF?>">
  <table border="0" cellpadding="3" cellspacing="0">
      <td><b>Texteingabe</b><br />
    <textarea name="text" cols="50" rows="10"></textarea></td>
    </tr>
    <tr><td>
    <input name="Submit" type="submit" value="Abschicken" /></td>
    </tr>
</table>
</form>
</body>
</html>


Ein bisschen gekürzt und wenn bei dir register_globals auf OFF steht, funktioniert es auch Augenzwinkern