Re: if inside an echo.
- From: news@xxxxxxxxxxxxx (Al)
- Date: Tue, 31 Jul 2007 10:11:47 -0400
foreach(range(0, 2000, 100) as $value){
$str= "<option value=\"$value\"";
$str .= ($value== $min_rent)? " selected=\"selected\"" : NULL;
echo $str . ">$value</option>";
}
Hulf wrote:
I am outputting a selectbox and want to do the follwoing. How can I add the IF statement inside the the echo?.
for ($value = 0; $value <= 2000; $value += 100) {
echo "<option value=\"$value\" if ($min_rent==$value) {echo selected="selected" }> $value</option>";
}
- References:
- if inside an echo.
- From: "Hulf"
- if inside an echo.
- Prev by Date: Re: [PHP] Array difficulty
- Next by Date: Re: [PHP] Re: Pirate PHP books online?
- Previous by thread: RE: [PHP] if inside an echo.
- Next by thread: Re: [PHP] if inside an echo.
- Index(es):