nl2br opnemen in script?

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

19/03/2004 12:39:00
Quote Anchor link
beste mensen,

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)
PHP script in nieuw venster Selecteer het PHP script
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
<?

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)
PHP script in nieuw venster Selecteer het PHP script
1
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>";
}
}

?>
 
PHP hulp

PHP hulp

29/04/2024 13:49:11
 

19/03/2004 12:41:00
Quote Anchor link
hmm... wordt niet helemaal goed weergegeven..

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>";
}
}
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.