I have a simple
<TEXTAREA NAME="comment" ROWS=6 COLS=40></TEXTAREA> within a form..
I would like to do is basically have any text typed into the text area echoed to the next page once the submit button is clicked...
I have no idea on how to do this..

Any help would be greatful..
LVL 11
Eaddy BarnesITAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

In the code for the page that form is being submitted to, use:

echo $_POST['comment'];
You can use this:

  echo 'Comment: ';
  echo htmlspecialchars($_POST['comment']);


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Brian BushSolutions ArchitectCommented:
echo $_REQUEST["comment"];

There you go 3 answers.
Tomeeboy assumes you used the post method to submit your form.
Roonaan, assumes that too, but checks first.

If you use $_REQUEST it will get a POST or GET form variable.
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

$_REQUEST will actually also get $_COOKIE variables, brian ;-)

Better to do it right to begin with, rather than compensate for the wrong method :)
I seriously, seriously doubt somebody would put textarea contents into $_GET.
Setting a Cookie is just as unlikely.
$_POST is the only Logical one.

But $_REQUEST should work for any case, unless it is being rewritten somewhere.
Everybody here answers the question... I'll just complement all of them.

Use lowercase HTML tags... and prefer to stylish things, not delivering to HTML this job.

You simple HTML code should be something like:

<textarea name="comment" style="width: 200px; height: 100px;"></textarea>

Even if you are building a simple script, you must have security in your mind. Imagine how many headaches will you have if you do not bother too much with security... even if you are a new programmer in the language, try to learn security techniques.
I think a good one to apply in your script is to htmlentities the user comment. Htmlentities is a function that converts any found chars that has another notation in HTML entity to its one. Good... but it supports a second argument that converts quotes, and I highly suggest you to use it.

so, the right way to output the send code is this:

    echo htmlentities($_POST['comment'], ENT_QUOTES);

Just put this sentence in your mind and try to follow it everytime: "Filter input, Escape output!"

I hope this helps...

Eaddy BarnesITAuthor Commented:
Thanks guys..

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.