• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 299
  • Last Modified:

textbox of $text on multiple lines

input textbox that posts and displays $text as multiple lines

I am not looking for an html textbox because html is too disorganized.

2 Solutions
<form action="./thisfile.php" method="POST">
<textarea name="text"></textarea>
<input type="submit">
print nl2br($_POST['text']);
this is the raw way without any validations or anything,... this one can be xss'd

$text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. In et nunc vitae tortor consequat auctor. In euismod, quam tincidunt luctus sollicitudin, mi elit lobortis libero, at posuere ipsum risus id leo. Donec nunc justo, iaculis vel molestie non, sodales vitae eros. Aliquam consequat, lacus et elementum tincidunt, nulla mi molestie mi, condimentum semper sem tortor eu nibh. Etiam lacus mauris, consectetur vel viverra rutrum, consectetur eget libero. Praesent placerat sodales turpis sed porta. Duis posuere urna enim, ac mattis nisi. Vivamus semper, tortor ac accumsan congue, lacus est tristique magna, sed scelerisque arcu ipsum quis tellus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed tellus ante, condimentum eget ultricies sit amet, venenatis sed justo.";

$tidy_text = wordwrap($text, $newline_every_so_many_characters, "\n");

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<div id="container">      



  echo "
  <p>Tidy text:</p>
  <textarea name='Tydy' rows='15' cols='50'>".$tidy_text."</textarea><br />
rgb192Author Commented:
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.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now