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

03-03-2009, 09:54 PM
how <textarea> data may be passed in a hidden form field or in a cookie ? is needed any encoding ? in javascript ?

03-03-2009, 10:44 PM
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:

<form action="next.php" method="post">
<textarea name="text"></textarea><br />
<input type="submit" name="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; ?>" />

03-04-2009, 07:49 AM
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) ...

03-04-2009, 12:57 PM
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.


03-04-2009, 06:32 PM
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) // 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 ?

03-05-2009, 12:06 AM
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?

03-05-2009, 04:50 AM
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 ?