|
Posted by David Haynes on 05/29/06 19:03
Ian Davies wrote:
> Thanks Aho
>
> 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?
>
> Ian
$lines = $_SESSION['line1'].'<br>'.$_SESSION['line2'];
or
$lines = sprintf("%s<br>%s", $_SESSION['line1'], $_SESSION['line2']);
or
$prefix = 'line';
$lines = '';
foreach($_SESSION as $key => $value) {
if( substr($key, 0, strlen($prefix)) == $prefix) {
if( $lines == '' ) $lines = $value;
else $lines = sprintf("%s<br>%s", $lines, $value);
}
}
This assumes that all the lines you want to join together begin with the
tag name 'line'. (e.g. line1, line2, line_foo, etc.)
-david-
[Back to original message]
|