473,386 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Any idea why echo selected isn't working in mozilla?

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

--
Patrick A. Smith Assistant System Administrator
Ocean Circulation Group – USF - College of Marine Science
http://ocgweb.marine.usf.edu Phone: 727 553-3334

The trouble with doing something right the first time is that nobody
appreciates how difficult it was. - La Rochefoucauld
Jun 9 '06 #1
3 2925
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
Jun 9 '06 #2
Erwin Moller wrote:
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


Hi Erwin,

Okay so I took echo "selected='$colm1'"; out and just have echo "SELECTED"

Oddly enough if I look at the source from the page it shows that it
should work. It just doesn't turn it to the correct letter on the
dropdown. <scratches head>

<select class="inform" name="colm1">
<option value="A" >A</option>
<option value="B" SELECTED>B</option>
<option value="C" >C</option>
</select>

Patrick
--
Patrick A. Smith Assistant System Administrator
Ocean Circulation Group – USF - College of Marine Science
http://ocgweb.marine.usf.edu Phone: 727 553-3334

The trouble with doing something right the first time is that nobody
appreciates how difficult it was. - La Rochefoucauld

Jun 9 '06 #3
Rik
Patrick wrote:
Erwin Moller wrote:
Patrick wrote:
<select class="inform" name="colm1">
<option value="A" <?php if (strcmp($colm1,$A)==0) echo
"selected='$colm1'";
> A</option>

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>

Okay so I took echo "selected='$colm1'"; out and just have echo
"SELECTED"
Oddly enough if I look at the source from the page it shows that it
should work. It just doesn't turn it to the correct letter on the
dropdown. <scratches head>

<select class="inform" name="colm1">
<option value="A" >A</option>
<option value="B" SELECTED>B</option>
<option value="C" >C</option>
</select>

XHTML perhaps? In which case it should be 'selected="selected"'.

Else, I wouldn't know

The above HTML-code produces correct dropdowns here. That's the exact code
you get from your script?

Grtz,
--
Rik Wasmus
Jun 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Cartensy | last post by:
Hi, I try to configure a php applic to load a config file (the purpose is to use in all the php pages variables definied in a config file) Here is a small example which describe my problem: My...
50
by: 127.0.0.1 | last post by:
With all the problems with having register_globals = on, I propose the following idea: We define register_globals_manual = on as a new configuration default. What this does is enable 3 new...
3
by: Michael Flanagan | last post by:
Of course "echo" is working, but I've got a case where php doesn't seem to be sending out the result of an "echo." I'm probably doing something wrong, but I can't see it. I've got the following...
8
by: Gregory Piñero | last post by:
Hi guys, I'm trying to run this statement: os.system(r'"C:\Program Files\Mozilla Firefox\firefox.exe"' + ' "www.blendedtechnologies.com"') The goal is to have firefox open to that website....
29
by: Jim Hubbard | last post by:
Yet another hotfix alert (http://www.kbalertz.com/Feedback_823535.aspx) that states "To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix." ...
3
by: Fendi Baba | last post by:
I am trying to write a simple Javascript code to pass value from a listbox to another field the following is my code f=document.forms; window.alert(f.FieldList.options.length)...
0
by: somaskarthic | last post by:
Hi I posted two queries. But i didn't get any replies. Pls go through my queries and try to give some ideas. Query (1): How to get the values of dynamically created checkboxes which are...
1
by: txguy | last post by:
we have a php generated order form that has textboxes for the item description a customer has selected to order. the code is working perfectly, but the text in the textboxes are at a normal font...
1
by: brendanmcdonagh | last post by:
<form name="<?php echo $namex?>" action="insert.php" method="POST"> <input type="submit" name="<?php echo $namex?>" value="Update"/> </form> ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.