textarea box in form, but displays as line in echo

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • entoone

    textarea box in form, but displays as line in echo

    I have a form that has a text box, i.e. text area that takes 200 characters
    max. When I use my update script and it brings up the information in the
    database, it displays as a single line. How can I keep the same format
    of a box, instead of single line when viewing the database data for
    updating?

    This is how I'm calling the information into the box

    <tr>

    <td width="100%">

    <font face="Arial" size="2">Additi onal Comments/Counties Covered</font></td>

    <td width="100%"> <input type="textarea" size="80" name="ud_commen ts"
    value="<? echo "$comments"?>"> </td>


    </tr>


  • point

    #2
    Re: textarea box in form, but displays as line in echo

    before entering data to database use nl2br() and before displaying from
    database strip_slashes() ...

    <input type="textarea"

    should be <textarea></textarea>..at least I use it like that....

    hope this helps....

    point


    "entoone" <entoone@pacbel l.net> wrote in message
    news:FaQXa.1496 $BR4.738@newssv r22.news.prodig y.com...[color=blue]
    > I have a form that has a text box, i.e. text area that takes 200[/color]
    characters[color=blue]
    > max. When I use my update script and it brings up the information in the
    > database, it displays as a single line. How can I keep the same format
    > of a box, instead of single line when viewing the database data for
    > updating?
    >
    > This is how I'm calling the information into the box
    >
    > <tr>
    >
    > <td width="100%">
    >
    > <font face="Arial" size="2">Additi onal Comments/Counties[/color]
    Covered</font></td>[color=blue]
    >
    > <td width="100%"> <input type="textarea" size="80"[/color]
    name="ud_commen ts"[color=blue]
    > value="<? echo "$comments"?>"> </td>
    >
    >
    > </tr>
    >
    >[/color]


    Comment

    • Jochen Daum

      #3
      Re: textarea box in form, but displays as line in echo

      Hi Entoone!

      On Tue, 05 Aug 2003 22:38:36 GMT, "entoone" <entoone@pacbel l.net>
      wrote:
      [color=blue]
      >I'm not quite following you on this one...
      >[/color]

      <input type="textarea" > is not valid html.
      <textarea> </textarea> is.

      Also, in contrary to point, 'd like to suggest to not use nl2br()
      before entering into the database, but on display. You may want to use
      addslashes() for a different problem, when inserting updating into the
      database. You may want to use stripslashes() on display, depending on
      the setting of magic_quotes.

      HTH, Jochen

      P.S.: Look up the functions and buzzwords on www.php.net.

      [color=blue]
      >
      >"point" <point@caanprod uction.com> wrote in message
      >news:bgoki801c mj@enews2.newsg uy.com...[color=green]
      >> before entering data to database use nl2br() and before displaying from
      >> database strip_slashes() ...
      >>
      >> <input type="textarea"
      >>
      >> should be <textarea></textarea>..at least I use it like that....
      >>
      >> hope this helps....
      >>
      >> point
      >>
      >>
      >> "entoone" <entoone@pacbel l.net> wrote in message
      >> news:FaQXa.1496 $BR4.738@newssv r22.news.prodig y.com...[color=darkred]
      >> > I have a form that has a text box, i.e. text area that takes 200[/color]
      >> characters[color=darkred]
      >> > max. When I use my update script and it brings up the information in the
      >> > database, it displays as a single line. How can I keep the same format
      >> > of a box, instead of single line when viewing the database data for
      >> > updating?
      >> >
      >> > This is how I'm calling the information into the box
      >> >
      >> > <tr>
      >> >
      >> > <td width="100%">
      >> >
      >> > <font face="Arial" size="2">Additi onal Comments/Counties[/color]
      >> Covered</font></td>[color=darkred]
      >> >
      >> > <td width="100%"> <input type="textarea" size="80"[/color]
      >> name="ud_commen ts"[color=darkred]
      >> > value="<? echo "$comments"?>"> </td>
      >> >
      >> >
      >> > </tr>
      >> >
      >> >[/color]
      >>
      >>[/color]
      >[/color]

      --
      Jochen Daum - CANS Ltd.
      PHP DB Edit Toolkit -- PHP scripts for building
      database editing interfaces.
      Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

      Comment

      • matty

        #4
        Re: textarea box in form, but displays as line in echo

        Jochen Daum wrote:
        [color=blue]
        >
        > Also, in contrary to point, 'd like to suggest to not use nl2br()
        > before entering into the database, but on display. You may want to use
        > addslashes() for a different problem, when inserting updating into the
        > database. You may want to use stripslashes() on display, depending on
        > the setting of magic_quotes.[/color]

        Personally, I use neither! If it's a text-in-chunks type thing, I convert
        linebreaks into paras (and vice versa) going between input and database, so
        that when you're displaying it, you can use the field straight from the
        database, with all the work done just the once, at the admin end


        Comment

        • entoone

          #5
          Re: textarea box in form, but displays as line in echo

          <td width="100%"> <textarea rows="4" name="ud_commen ts" cols="60"><?
          echo "$comments" ?></textarea></td>


          I'm able to call the information from the db and have it displayed into a
          textarea box. The only thing is when I save it back to the database, via an
          update button. The line doesn't wrap.. it just makes the page format go
          bonkers! --- what do I need to do to keep it formatted without messing up
          the entire page that display it
          after it's been saved.



          "matty" <matt+nntp@askm enoquestions.co .uk> wrote in message
          news:yBXXa.5294 6$9C6.3144915@w ards.force9.net ...[color=blue]
          > Jochen Daum wrote:
          >[color=green]
          > >
          > > Also, in contrary to point, 'd like to suggest to not use nl2br()
          > > before entering into the database, but on display. You may want to use
          > > addslashes() for a different problem, when inserting updating into the
          > > database. You may want to use stripslashes() on display, depending on
          > > the setting of magic_quotes.[/color]
          >
          > Personally, I use neither! If it's a text-in-chunks type thing, I convert
          > linebreaks into paras (and vice versa) going between input and database,[/color]
          so[color=blue]
          > that when you're displaying it, you can use the field straight from the
          > database, with all the work done just the once, at the admin end
          >
          >[/color]


          Comment

          Working...