RE: [PHP] if inside an echo.
- From: edward@xxxxxxxxxx ("Edward Kay")
- Date: Tue, 31 Jul 2007 12:48:29 +0100
-----Original Message-----
From: alan.milnes@xxxxxxxxx [mailto:alan.milnes@xxxxxxxxx]On Behalf Of
Alan Milnes
Sent: 31 July 2007 12:41
To: php-general@xxxxxxxxxxxxx
Subject: Re: [PHP] if inside an echo.
On 31/07/07, Hulf <ross@xxxxxxxxxxxxxx> wrote:
I am outputting a selectbox and want to do the follwoing. Howcan I add the
IF statement inside the the echo?
Something like this:-
for ($value = 0; $value <= 2000; $value += 100) {
echo "<option value=\"$value\";
if ($min_rent==$value) {
echo "selected=\"selected\"";
}
echo "> $value</option>";
Alan
Snap :) One small point though; you're missing a required space before
selected. It should be:
echo " selected=....
otherwise you won't output valid HTML.
E
.
- References:
- Re: [PHP] if inside an echo.
- From: "Alan Milnes"
- Re: [PHP] if inside an echo.
- Prev by Date: Re: [PHP] Blooging Portal
- Next by Date: Re: [PHP] Authentication
- Previous by thread: Re: [PHP] if inside an echo.
- Next by thread: Re: if inside an echo.
- Index(es):
Relevant Pages
|