views:

129

answers:

3

Hello,

I'm trying to get some input from a user and use that input in a php script. Right now I have a form tag, from the little I understand, this cannot have multiline input. The solution seems to be a TextArea, however I'm not sure how to get the input from a TextArea.

Here's my code with the form :

<form action="traitement_cmd.php" method="post" >
    Enter Cmd: <input type="text" size="100" maxlength="100" name="cmd"/>
</form>

The textarea tag doesn't seem to have the same attributes as a form tag, so I'm not sure how I should change my code. I also need a button for the user to click to send his input to the php script.

How can I change my code to do this ?

Thank you.

A: 

You can just put the textarea inside the form, and the submit button too:

<form action="traitement_cmd.php" method="post" >
    Enter Cmd: <textarea rows="5" cols="80" name="cmd"/>
 <input type="submit" value="Submit"/>
</form>
Rich
a-hathank you, I thought i was suposed to change the for by a textarea, silly me !
JoOb
A: 

textarea attributes are "rows" and "cols".

Aif
+1  A: 

Straight from the source, the HTML 4.01 standard:

This example creates a TEXTAREA control that is 20 rows by 80 columns and contains two lines of text initially. The TEXTAREA is followed by submit and reset buttons.

<FORM action="http://somesite.com/prog/text-read" method="post">
   <P>
   <TEXTAREA name="thetext" rows="20" cols="80">
   First line of initial text.
   Second line of initial text.
   </TEXTAREA>
   <INPUT type="submit" value="Send"><INPUT type="reset">
   </P>
</FORM>
Brian Campbell