Or another way... for ($value = 0; $value <= 2000; $value += 100) { echo sprintf("<option value=\"%s\"%s>%s</option>", $value, (($min_rent==$value) ? " selected=\"selected\"" : NULL), $value); } Hulf wrote: > ************************** > This Email Has Been Virus Swept > ************************** > 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>"; > > } > ******************************************************************* ATTENTION: E-mail addressed to the addressee@xxxxxxxxx will only be delivered for a limited period. Please update your address book using the "From" address on this e-mail. This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt and then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of L-3 Communications ASA Ltd. Sent from L-3 Communications ASA Ltd. Registered in England and Wales Company No. 1730717 Registered Office: 5th Floor, Chiswell Street, London EC1Y 4UP ******************************************************************* This Email has been Virus Checked ******************************************************************* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php