You are here: Re: joining variables together « All PHP « IT news, forums, messages
Re: joining variables together

Posted by J.O. Aho on 05/29/06 19:13

Ian Davies wrote:

> sorry I should have added, what if I want each newly added item to the
> session to display as seperat lines when returned to a text field?


$_SESSION['savedcomm'] = $_SESSION['savedcomm'] . "\n" . $_POST['selectcomm'];

This would add new line between the old and new data.

If you want to display it in a html section, then you can use nl2br()
http://www.php.net/manual/en/function.nl2br.php

<h2><?php echo nl2br($_SESSION['savedcomm']); ?></h2>

If you add things to a textarea, then do

<textarea name="thetext" rows="20" cols="80"><?php echo
$_SESSION['savedcomm']; ?></textarea>

Here you don't use the nl2br as the the textarea element does respect the new
line, which isn't done in html otherwise.


//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация