2

enter image description here

Is there any way I can make the Description box become into two lines box instead of a single line block?

<label>Description</label>
<input type="text" name="description" size="50" required class="input" placeholder="Enter the description of the product">           
Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
Chuen Yik Kang
  • 83
  • 1
  • 11

2 Answers2

2

unfortunately HTML doesn't allow you to make an input multi-line but you can use a textarea instead. (See the code snippet below) I've set "rows" to 2 since you mentioned you wanted it to take 2 lines instead of just 1, you can change that to be whatever number of lines you want.

<form action="/form/submit" method="post">
   <label for="text">Description:</label>
   <br>
   <textarea id="text" name="text" rows="2" cols="50"></textarea>
   <br/>
   <input type="submit" value="Submit">
</form>
0

You Should use Textarea while inserting data and when you want to show/echo the data use this PHP function to preserve the line breaks echo nl2br($string);

For example

    <textarea class="form-control" name="short_desc" required></textarea>

and for frontend echo use following function

<?PHP echo nl2br($short_desc);?>

It will preserve the line break and show content with breaks on frontend,

Also keep the Mysql data type text for it.

Hassan Qasim
  • 463
  • 5
  • 5