mmm... das sind jetzt ein bischen viele Sachen auf einmal! :)
Also wie du sachen aus einer Textdatei editiren kannst, kann ich dir nicht sagen!
Ich nehme mal an, du willst, dass alle Leute die was in das Formularfeld eingeben das ganze in ein und der selben Textdatei speichern?!?
Wie das mit dem klicken geht, kann ich dir leider auch nicht sagen, das is JavaScript, ich kann dir nur sagen, wie du den BBCode dann nachher umwandelst!
Die Datei die das alles erledigt könnte dann so aussehen:
Code:
<?php
function bbcode($wert1) {
$this[] = "/</si";
$this[] = "/>/si";
$this[] = "/
/";
$this[] = "/(.*?)/si";
$this[] = "/(.*?)/si";
$this[] = "/(.*?)/si";
$this[] = "/(.*?)/si";
$this[] = "/(.*?)/si";
$this[] = "//si";
$this[] = "//si";
$this[] = "/[color=(.*?)](.*?)[/color]/si";
$this[] = "/[size=(.*?)](.*?)[/size]/si";
$this[] = "/[img](.*?)[/img]/si";
$repl[] = "<";
$repl[] = ">";
$repl[] = "<BR>";
$repl[] = "<a href="1" target="_blank">1</a>";
$repl[] = "<a href="1" target="_blank">2</a>";
$repl[] = "<b>1</b>";
$repl[] = "<u>1</u>";
$repl[] = "<i>1</i>";
$repl[] = "<table border=0 cellpadding=0 cellspacing=0><tr><td width=20> </td><td bgcolor="#000000"><table border=0 cellpadding=5 cellspacing=1><tr><td bgcolor="#EEEEFF"><code><B>Code:</B><BR>1</code></td></tr></table></td></tr></table>";
$repl[] = "<table border=0 cellpadding=0 cellspacing=0><tr><td width=20> </td><td bgcolor="#000000"><table border=0 cellpadding=5 cellspacing=1><tr><td bgcolor="#EEEECC"><code><B>Zitat:</B><BR>1</code></td></tr></table></td></tr></table>";
$repl[] = "<font color="1">2</font>";
$repl[] = "<font size="1">2</font>";
$repl[] = "<img src="1" border=0>";
$count_this = count($this);
$count_repl = count($repl);
$i=0;
while($i<$count_this) {
$wert1 = preg_replace($this[$i],$repl[$i],$wert1);
$i++;
}
return $wert1;
}
if ($add AND $add==1) {
$file = fopen('info.txt','a');
$text = bbcode($text);
$text .= "n";
fputs($file,$text);
fclose($file);
echo "Die Daten wurden hinzugefügt!";
$text="";
$add="";
exit;
}
?>
<form action="<?php echo $PHP_SELF; ?>" method=post>
<textarea name="text" rows=20 cols=40></textarea>
<input type=hidden name=add value=1>
<input type=submit name="hinzufügen" value="hinzufügen">
</form>
So sollte das funtionieren!