develooper Front page | perl.beginners | Postings from December 2002

Re: using \n in a cgi script

Thread Previous | Thread Next
From:
Jenda Krynicky
Date:
December 31, 2002 03:53
Subject:
Re: using \n in a cgi script
Message ID:
3E119337.19222.3603EB5C@localhost
From: dhoubrechts <dhoubrechts@cybernet.be>
> Every time I want to use a perl script as a cgi the "\n" ending the
> phrases doesn't make it going at the beginning of the next line. Why ?
> Several script coming from Perl in Action (O'Reilly) have those "\n"
> ending those phrases. Here are some lines coming from one of them :
> sub document_de_garde {
>     my $actif = shift;
>     return unless $actif;
> 
>     print "<H1>Salut\&nbsp;!</H1>\n";
>     print "Bienvenue dans notre magasin d'habillement\&nbsp;!\n";
>     print "Faites votre choix dans le menu ci-dessous.\n";
> 
>     menu_boutique();}

Your CGI creates (or better should create) HTML. How would you expect 
this "HTML" to be displayed?

	<H1>Salut&nbsp;!</H1>
	Bienvenue dans notre magasin d'habillement&nbsp;!
	Faites votre choix dans le menu ci-dessous.

If you want to insert a linebreak in HTML you have to use <BR> and if 
you want something to be a paragraph you should enclose it in 
<P>...</P>.

Jenda
===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
	-- Terry Pratchett in Sourcery


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About