Solved

textbox of $text on multiple lines

Posted on 2011-02-24
3
291 Views
Last Modified: 2012-05-11
input textbox that posts and displays $text as multiple lines

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


line1
line2
line3
0
Comment
Question by:rgb192
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Accepted Solution

by:
MrDanielBang earned 250 total points
ID: 34975260
<form action="./thisfile.php" method="POST">
<textarea name="text"></textarea>
<input type="submit">
</form>
<?php
print nl2br($_POST['text']);
?>
----
this is the raw way without any validations or anything,... this one can be xss'd
0
 
LVL 1

Assisted Solution

by:pmainardi
pmainardi earned 250 total points
ID: 34975280
<?php
$newline_every_so_many_characters=40;

$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">
<html>
<head>
<title>textbox</title>

</head>
<body>
<div id="container">      


<h1>Textbox</h1>

<?php

  echo "
  <p>Tidy text:</p>
  <form>
  <textarea name='Tydy' rows='15' cols='50'>".$tidy_text."</textarea><br />
  </form>";
   
?>
</div>
</body>
</html>
0
 

Author Closing Comment

by:rgb192
ID: 34981932
thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
This article discusses how to implement server side field validation and display customized error messages to the client.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question