php - Post text from a text area -
i have form user types paragraphs text area , takes them page after submit. how can pass whatever typed page after submit? text area might have linebreaks , if use query string pass data, gives me error. current code pass field:
<?php if(isset($_post['form'])) { $title = $_post['title']; $body = $_post['body']; header("submitform.php?title=$title&body=$body"); ?> <html> ...html form...
it doesn't work when text area has line breaks in it.
i suggest installing wysiwyg editor make easier you, assume add time learning curve.
the simplest tips can give set css attribute textarea: white-space:pre
when gets submitted, line breaks sent well. on server side, need use nl2br()
function, when gets saved on db or wherever store them, line breaks converted html breaks.
for additional reference, had similar question last year.
Comments
Post a Comment