Re: text wrap in table
| From: | Adrian D'Costa | Date: | Sat, 25 Aug 2001 07:29:42 +0000 |
| Subject: | Re: text wrap in table | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-64416@lists.php.net to get a copy of this message | ||
Hi,
I got the answer from one earlier mail. I used nl2br(). It does just
what I want.
Adrian
On Fri, 24 Aug 2001, Adrian D'Costa wrote:
> Hi,
>
> I am creating a program for a newspaper to publish their article
> online. There is a form what allows them to cut and past from their
> editors (word, pagemaker, staroffice). The data is being entered
> correctly.
>
> The problem is when I try and get the data from the table the whole matter
> scrolls off the screen. I need it to be formatted as the client cut and
> pastes it (headings, paras, etc). Below is my table and part of my
> program.
>
> mysql> desc newsarticles;
> +----------+--------------+------+-----+------------+----------------+
> | Field | Type | Null | Key | Default | Extra |
> +----------+--------------+------+-----+------------+----------------+
> | id | int(5) | | PRI | NULL | auto_increment |
> | nid | int(5) | | MUL | 0 | |
> | headline | varchar(100) | | | | |
> | article | mediumtext | | | | |
> | date | date | | | 0000-00-00 | |
> | imgpath | varchar(200) | YES | | NULL | |
> +----------+--------------+------+-----+------------+----------------+
>
> <html>
> <head>
> <title><? echo $row->headline; ?></title>
> </head>
>
> <body bgcolor="white">
> <h1 align="center"><? echo $row->headline; ?></h1>
> <h3 align="center"><? echo $row->description; ?></h3>
> <table width="600" border="1">
> <tr>
> <td valign="top" width="70%"><font
> face="Arial" size="2" color="blue"><strong><? echo
> $sd ."-". $sm
> ."-". $sy; ?></strong><br><pre><? echo $row->article;
> ?></pre></font></td>
> <td valign="top" width="30%"><img src="<?
> echo
> $row->imgpath; ?>" <? echo $iwh[3]; ?> ></td>
> </tr>
> </table>
> </body>
> </html>
>
>
> I use the <pre></pre> to display with the line breaks. If I take of the
> <pre> it does not wrap but does not give the breaks. To my thinking maybe
> while entering the data we should give break the lines physically. This
> is part of my entry form.
>
> <tr>
> <td><font face="Arial"
> size="2">HeadLine</font></td>
> <td><input type="text" name="headline"
> size="30">
> </tr>
>
> <tr>
> <td><font face="Arial"
> size="2">Article</font></td>
> <td><textarea name="article" cols="60"
> rows="10"></textarea></td>
> </tr>
>
> <tr>
> <td><font face="Arial" size="2">Upload
> Image</font></td>
> <td><input type="file" name="userfile" size="30"
> wrap=ON></td>
> </tr>
> <tr align="center">
> <td colspan="2"><input type="submit"
> value="Submit"></td>
> </tr>
>
>
> How do I get the text not to wrap and to preserve the formatting given by
> the client.
>
> Adrian
>
>