Form Formatting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tecton
Forum Newbie
Posts: 22
Joined: Sat Dec 20, 2003 1:58 am
Contact:

Form Formatting

Post by tecton »

how do you have a text box pass its formatting through a form?

as in line breaks and spaces
jaxn
Forum Commoner
Posts: 55
Joined: Fri Jan 16, 2004 1:50 pm
Location: Nashville, TN

Post by jaxn »

if you are wanting text entered in a textarea to be displayed on an html page and keep the line breaks, use the nl2br() function on the posted form field.

Code: Select all

<?php
$formatted_text = nl2br($_POST['your_textarea']);
?>
Post Reply