use ".=" instead of "="

 $echo .= "<li><a href='". $link ."'>". $name ."</a></li><br>";

(remember to initialise $echo = "" somewhere first just in case is contains
something from elsewhere)

-----Original Message-----
From: Dan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 11, 2002 11:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Arrays


I have figured out how to do it thanks for you guys help..

Just one thing...

<?
$contact = array( 'moreinfo.php' => 'More Info'
    , 'contact.php' => 'Contact Us'
    , 'apage.php' => 'A Page'
    );
foreach ($contact as $link => $name)
{
 echo "<li><a href='". $link ."'>". $name ."</a></li><br>";
}
?>

What I need to do now is in the echo string is make use something like:

 $echo = "<li><a href='". $link ."'>". $name ."</a></li><br>";

I have tryed doing it this way but it will only desplay one array when I
call $echo down the page.

What can I do to desplay all of them?


"Dan" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm trying to get my head around arrays and how to munipulate them.
>
> what I need to do is add html around the arrays eg.
> <li><a href='".$link(0)."'>".$name."</a></li>;
>
> I have my head around that but I the number of lines the I need to create
is
> going to change so I need the script to repeat untill all the arrays are
> used.
>
> --
> -----------------------------------------
> Daniel Broome, siliconBLUE Ltd, Web Author,
> http://siliconblue.com
> Mob: 64-21-178-5120
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to