pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feednewlines won't display in browser
3+ messages / 3 participants
[nested] [flat]
* newlines won't display in browser
@ 2003-10-13 02:01 Michael Hanna <taojones@sympatico.ca>
2003-10-13 02:36 ` Re: newlines won't display in browser Rod K <rod@23net.net>
2003-10-13 14:35 ` Re: newlines won't display in browser Robby Russell <rrussell@commandprompt.com>
0 siblings, 2 replies; 3+ messages in thread
From: Michael Hanna @ 2003-10-13 02:01 UTC (permalink / raw)
To: pgsql-php
Hi,
hi, how do you put a newline in a TEXT data type?
when inputting from a form into a textarea box..the return key creates
a newline, which is reflected in psql monitor but not when displaying
the page with php
when I try inputting \n in the browser textarea form, they appear in
the webpage for some reason, in psql monitor, they appear as "\n" but
also make a newline
Michael
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: newlines won't display in browser
2003-10-13 02:01 newlines won't display in browser Michael Hanna <taojones@sympatico.ca>
@ 2003-10-13 02:36 ` Rod K <rod@23net.net>
1 sibling, 0 replies; 3+ messages in thread
From: Rod K @ 2003-10-13 02:36 UTC (permalink / raw)
To: Michael Hanna <taojones@sympatico.ca>; pgsql-php
Do newlines show up in HTML? No, they don't, you have to use a <br /> tag
for that, which is why PHP provided the nl2br() function.
> -----Original Message-----
> From: pgsql-php-owner@postgresql.org
> [mailto:pgsql-php-owner@postgresql.org]On Behalf Of Michael Hanna
> Sent: Sunday, October 12, 2003 10:02 PM
> To: pgsql-php@postgresql.org
> Subject: [PHP] newlines won't display in browser
>
>
> Hi,
>
> hi, how do you put a newline in a TEXT data type?
>
> when inputting from a form into a textarea box..the return key creates
> a newline, which is reflected in psql monitor but not when displaying
> the page with php
>
> when I try inputting \n in the browser textarea form, they appear in
> the webpage for some reason, in psql monitor, they appear as "\n" but
> also make a newline
>
> Michael
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: newlines won't display in browser
2003-10-13 02:01 newlines won't display in browser Michael Hanna <taojones@sympatico.ca>
@ 2003-10-13 14:35 ` Robby Russell <rrussell@commandprompt.com>
1 sibling, 0 replies; 3+ messages in thread
From: Robby Russell @ 2003-10-13 14:35 UTC (permalink / raw)
To: pgsql-php
Michael Hanna wrote:
> Hi,
>
> hi, how do you put a newline in a TEXT data type?
>
> when inputting from a form into a textarea box..the return key creates a
> newline, which is reflected in psql monitor but not when displaying the
> page with php
>
> when I try inputting \n in the browser textarea form, they appear in the
> webpage for some reason, in psql monitor, they appear as "\n" but also
> make a newline
>
> Michael
>
I'd suggest doing this in your postgresql statement. Makes it easy when
you use views and don't want to use php functions everywhere to do the
task that postgresql can do for you.
Perhaps plphp ? (since you know php)
https://www.commandprompt.com/entry.lxp?lxpe=294
# Here is an example plphp function.
CREATE OR REPLACE FUNCTION line_breaks(text) RETURNS text AS '
$txt = str_replace("\n","<br>\n",$arg0);
if ($txt) {
return $txt;
}
else {
return $arg0;
}
' LANGUAGE 'plphp';
Then on a select, I'd run
SELECT id, line_breaks(textbox_field) as textbox_field FROM table;
It would then replace all instances of \n with <br>\n.
Cheers,
Robby
--
Robby Russell, | Sr. Administrator / Lead Programmer
Command Prompt, Inc. | http://www.commandprompt.com
rrussell@commandprompt.com | Telephone: (503) 222.2783
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-10-13 14:35 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-10-13 02:01 newlines won't display in browser Michael Hanna <taojones@sympatico.ca>
2003-10-13 02:36 ` Rod K <rod@23net.net>
2003-10-13 14:35 ` Robby Russell <rrussell@commandprompt.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox