Reply to Re: Any idea why echo selected isn't working in mozilla?

Your name:

Reply:


Posted by Erwin Moller on 06/09/06 15:12

Patrick wrote:

> Hi All,
>
> Why does this work in Internet Explorer, but not Mozilla?
> I'm reading from a flat file.
>
> As an examle the value of colm1 read from the file is B.
>
> I set in the form page;
>
> <?php $A = 'A'; $B = 'B' ; $C = 'C'; ?>
>
> <select class="inform" name="colm1">
> <option value="A" <?php if (strcmp($colm1,$A)==0) echo
> "selected='$colm1'";
> ?>>A</option>
> <option value="B" <?php if (strcmp($colm1,$B)==0) echo
> "selected='$colm1'";
> ?>>B</option>
> <option value="C" <?php if (strcmp($colm1,$C)==0) echo
> "selected='$colm1'";
> ?>>C</option>
> </select>
>
> Thanks for your thoughts,
> Patrick
>

Hi Patrick,

Your setup produces illegal HTML and Explorer doesn't mind appearantly, but
FF does.
The reason it is illegal is that SELECTED has no value.

Good select-box looks like this:
<select name="bla">
<option value="1">1
<option value="2" SELECTED>2
<option value="3">3
</select>

Regards,
Erwin Moller

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация