简体   繁体   中英

MultiLine Form in HTML?

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.

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"></textarea> <input type="submit" value="Submit"/> </form> 

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> 

textarea属性是“rows”和“cols”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM