Results 1 to 7 of 7

Thread: how <textarea> data may be passed in a hidden form field or in a cookie ? is needed a

  1. #1
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default how <textarea> data may be passed in a hidden form field or in a cookie ? is needed a

    how <textarea> data may be passed in a hidden form field or in a cookie ? is needed any encoding ? in javascript ?
    Last edited by leonidassavvides; 03-03-2009 at 09:55 PM. Reason: add

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    What do you mean? What do you want the process to be? Do you want someone to submit a form, then move on to the next page where the textarea from the previous page is hidden inside a hidden input? Or while your typing, the hidden input is changed the to textarea's value(may I ask why you would want that if thats what you want?).

    If you were to do the first thing I said, it would be something like this:
    Code:
    <form action="next.php" method="post">
    <textarea name="text"></textarea><br />
    <input type="submit" name="submit" />
    </form>
    (next.php)
    PHP Code:
    <?php
      
    if(isset($_POST['submit'])){
        if(!empty(
    $_POST['text']) || $_POST['text'] != ""){
          
    $hidden $_POST['text'];
        } else {
          die(
    "You forgot to fill in something, bud!");
        }
      } else { 
        die(
    "You have to press the submit button before you can get here!");
      }
    ?>
    <form action="idk.php" method="post">
    <input type="hidden" value="<?php echo $hidden?>" />
    </form>
    Jeremy | jfein.net

  3. #3
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    I mean what if textarea has points user hit the ENTER key in the end of line(new line char) ? rather than that, exist any other trick ?
    I want appear a textarea with some other controls. and in the same page another form(text fields) ,if the latter submitted the same page reappears with values entered in the first form (textarea&controls) the same as they were, and as second form(in place of second form before that disappears now) and in its place takes another form - a button with hidden fields including first textarea field as hidden (if you modify textarea in the latest stage then the new value appear in the hidden not the first) , well ?

    I am using XHTML/JAVASCRIPT/PHP/MYSQL, I think the point is with javascript, hiddens and cookies (textarea data) ...

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Please use proper grammar. If English is not your first language, please spell check and grammar check.


    I know English is probably your second language, but I cannot understand you, and that means I cannot help you.

    Sorry!!
    Jeremy | jfein.net

  5. #5
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    If in a textarea a user hit the ENTER key in the end of line(new line char) may still store this string data to a javascript hidden or cookie ?? just tell me what to do to store,...encoding...? rather than that, exist any other trick ?

    page1(submits to page2(form2))
    =====
    form1(textarea)
    form2(register)

    page2
    =====
    form1(textarea) // takes values from page1
    form3(hiddens incl. textarea-takes values via js-onchange---submit to database the textarea)
    ---------------------------------------------------
    I want to enter to database table the textarea html field from form1, well I must store its value to hiddens and to keep state between page1 & page2 to cookies, what to do ?
    how encode new lines ?

  6. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    What happens with the user presses the return/enter button. Does it not record? Or do you want the enter line to be in that cookie? So when it inserts the database it will have an enter?
    Jeremy | jfein.net

  7. #7
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    when we press submit (form2 page1) the nextpage's textarea has no value, samely the hidden when press submit (form3 page2) has no value so comments db/table/field do not get value , well ?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •