RE: [PHP] if inside an echo.





-----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. How
can 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
.



Relevant Pages

  • Subtle bug I cannot find
    ... # It's task is to verify input file has correct settings ... # Since this scrip creates the file under test, there should be nothing missing. ... # array entries are blanked as ck_value finds them. ... echo "vtiger.com recommends setting/changing these values in ...
    (comp.unix.shell)
  • Re: tcsh / tset problem on 4.7 only?
    ... > Missing]. ... I just encountered this bug on 4.8-STABLE as well. ... # eval `echo '{['` ... for vt100 contains {{in the ac capability. ...
    (freebsd-hackers)
  • Re: Transparent tool in 2007 gone?
    ... might help you find various features you're missing. ... The commands on that link don't show any of the drawing or picture tools. ... Echo [MS PPT MVP] http://www.echosvoice.com ...
    (microsoft.public.powerpoint)
  • missing argument and undefined variable on google map class
    ... The missing argument is from the related class line 1 & 2 on the ... # Set map size ... echo $gm->MapHolder; ...
    (comp.lang.php)
  • Re: Drop $ with sed
    ... followed by one or more digits and remove the $. ... What am I missing here? ... Er, replying to the wrong post, Dave? ...
    (comp.unix.shell)