nl2br opnemen in script?
Kan iemand mij vertellen hoe ik die nl2br functie kan invoegen in onderstaand script? ik wil namelijk gewoon text kunnen invoeren, die vervolgens weergegeven moet worden als HTML (althans ik wil niet dat alle tekst op 1 regel komt)..
Toevoegstukje:
Code (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
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
<?
if($action=="add")
{
if($title||$date||$summary||$full)
{
$insertIt=mysql_query("INSERT INTO `news` (`title`, `date`, `summary`, `full`) VALUES ('$title', '$date', '$summary', '$full') ",$db);
if($insertIt)
{
echo "Newsitem successfully added<br />";
}
else
{
echo "Sorry, there has been an error<br />";
}
}
else
{
echo "
<form method=\"post\" action=\"$PHP_SELF\">
?>
if($action=="add")
{
if($title||$date||$summary||$full)
{
$insertIt=mysql_query("INSERT INTO `news` (`title`, `date`, `summary`, `full`) VALUES ('$title', '$date', '$summary', '$full') ",$db);
if($insertIt)
{
echo "Newsitem successfully added<br />";
}
else
{
echo "Sorry, there has been an error<br />";
}
}
else
{
echo "
<form method=\"post\" action=\"$PHP_SELF\">
?>
showstukje:
Code (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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?
if($action=="full")
{
$editresult = mysql_query("SELECT * FROM `news` WHERE id=$id",$db);
if ($therow = mysql_fetch_array($editresult))
{
echo "<b>Title</b>:<br />";
printf($therow["title"]);
echo "<br /><br /><b>Date</b>:<br />";
printf($therow["date"]);
echo "<br /><br /><b>Summary</b>:<br />";
printf($therow["summary"]);
echo "<br /><br /><b>Full Story</b>:<br />";
printf($therow["full"]);
echo "<br /><br />";
echo "<br /><a href=\"$PHP_SELF\">Main menu</a><br />";
}
else
{
echo "Sorry there has been an error<a href=\"$PHP_SELF\">Back</a>";
}
}
?>
if($action=="full")
{
$editresult = mysql_query("SELECT * FROM `news` WHERE id=$id",$db);
if ($therow = mysql_fetch_array($editresult))
{
echo "<b>Title</b>:<br />";
printf($therow["title"]);
echo "<br /><br /><b>Date</b>:<br />";
printf($therow["date"]);
echo "<br /><br /><b>Summary</b>:<br />";
printf($therow["summary"]);
echo "<br /><br /><b>Full Story</b>:<br />";
printf($therow["full"]);
echo "<br /><br />";
echo "<br /><a href=\"$PHP_SELF\">Main menu</a><br />";
}
else
{
echo "Sorry there has been an error<a href=\"$PHP_SELF\">Back</a>";
}
}
?>
in tekst;
//Start Full
if($action=="full")
{
$editresult = mysql_query("SELECT * FROM `news` WHERE id=$id",$db);
if ($therow = mysql_fetch_array($editresult))
{
echo "<b>Title</b>:<br />";
printf($therow["title"]);
echo "<br /><br /><b>Date</b>:<br />";
printf($therow["date"]);
echo "<br /><br /><b>Summary</b>:<br />";
printf($therow["summary"]);
echo "<br /><br /><b>Full Story</b>:<br />";
printf($therow["full"]);
echo "<br /><br />";
echo "<br /><a href=\"$PHP_SELF\">Main menu</a><br />";
}
else
{
echo "Sorry there has been an error<a href=\"$PHP_SELF\">Back</a>";
}
}