Insert Text From TEXTAREA into MySQL

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

    #1

    Insert Text From TEXTAREA into MySQL

    Hi,

    I'm trying to figure out how to INSERT/UPDATE text from TEXAREA into
    MySQL. Because TEXAREA has no VALUE, I'm hitting a brick wall here.

    Thanks!

  • Rik

    #2
    Re: Insert Text From TEXTAREA into MySQL

    TristaSD wrote:[color=blue]
    > Hi,
    >
    > I'm trying to figure out how to INSERT/UPDATE text from TEXAREA into
    > MySQL. Because TEXAREA has no VALUE, I'm hitting a brick wall here.[/color]

    Euhm, I have no clue what a TEXAREA is, but for a textarea's it's pretty
    straight forward. Echo existing content between the tags, and just read
    $_POST['name of your textarea'] if the form method is post....



    Grtz,
    --
    Rik Wasmus


    Comment

    • TristaSD

      #3
      Re: Insert Text From TEXTAREA into MySQL

      Rik,

      Could you give me an example? I'm not following you.


      Rik wrote:[color=blue]
      > TristaSD wrote:[color=green]
      > > Hi,
      > >
      > > I'm trying to figure out how to INSERT/UPDATE text from TEXAREA into
      > > MySQL. Because TEXAREA has no VALUE, I'm hitting a brick wall here.[/color]
      >
      > Euhm, I have no clue what a TEXAREA is, but for a textarea's it's pretty
      > straight forward. Echo existing content between the tags, and just read
      > $_POST['name of your textarea'] if the form method is post....
      > http://www.w3schools.com/tags/tag_textarea.asp
      >
      >
      > Grtz,
      > --
      > Rik Wasmus[/color]

      Comment

      • Rik

        #4
        Re: Insert Text From TEXTAREA into MySQL

        TristaSD wrote:[color=blue]
        > Could you give me an example? I'm not following you.[/color]

        1. Learn to quote.
        2. some pseudocode, I'm not going to write it all out, protect against SQL
        injection, and so on:

        <?php

        if(isset($_POST['submit'])){
        mysql_query("UP DATE table SET field='".$_POST['my_textfield']."' WHERE
        something");
        } else {
        $field= mysql_query('SE LECT field FROM table WHERE something');
        echo "<textarea name='my_textfi eld'>$field</textarea>";
        }
        ?>

        Grtz,
        --
        Rik Wasmus


        Comment

        • Ahazu

          #5
          Re: Insert Text From TEXTAREA into MySQL

          <textarea name="text" rows="15" cols="40"></textarea><br/>

          Comment

          Working...