RE: [PHP] enum('part1','...')
| From: | Chris | Date: | Tue, 24 Feb 2004 05:07:20 +0000 |
| Subject: | RE: [PHP] enum('part1','...') | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-178636@lists.php.net to get a copy of this message | ||
It's not obvious what language You mean, but I think this will work for you:
$aDistrict = array('part1','part2','part3','part4');
foreach($aDistrict as $sDistrict)
{
echo '<a
href="page.htm#',$sDistrict,'">',$sDistrict,"</a>\n";
}
Note: I'm using single quotes for some of the string chunks to eliminate the
multiple backslashes for the double quotes. I'm also using commas to echo
the 5 parts in sequence, rather than concatenate them then echo the result.
> -----Original Message-----
> From: John Taylor-Johnston [mailto:taylorjo@collegesherbrooke.qc.ca]
> Sent: Monday, February 23, 2004 7:58 PM
> To: php-general@lists.php.net
> Cc: John Taylor-Johnston
> Subject: [PHP] enum('part1','...')
>
>
> Basically I have an enum field. I would like to extract the parts
> of the field to create some html.
>
> district enum('part1','part2','part3','part4')
>
> while (district??)
> {
> echo "<a
> href=\"page.htm#".district[0]."\">".district[0]."</a>
> }
>
> <a href="page.htm#part1">part1</a>
> <a href="page.htm#part2">part2</a>
> <a href="page.htm#part3">part3</a>
> <a href="page.htm#part4">part4</a>
>
> Can I even do this? How?
>
> J
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php