Page 1 of 1

invisible items..

Posted: Sun Jan 11, 2004 3:31 am
by apek
i have problems with my combobox...
heres the snippet:

Code: Select all

$query2 = "Select left(idMinor,1) from ".$DBprefix." tPartMinor where left(idMinor,1)='$minor' group by idMinor";
	$result2 = mysql_query($query2);
			while ($dbq2 = mysql_fetch_array($result2)) {
			echo("<option value=$dbq2&#1111;idMinor]selected>$dbq2&#1111;idMinor]</option>\n");
			&#125;
when i view in browser,all the items seems invisible from users...
it canbe selected but i can't see what is that...
why do this happen??
is there any wrong with my code?
how to fix this???

Posted: Sun Jan 11, 2004 5:50 am
by fastfingertips
Hm first of all you should test what you have received from that sql and only then make fetch.
It is probably a mysql query problem

Posted: Sun Jan 11, 2004 7:03 am
by JAM
Sidenote, you also need to work on how to close the values in the form, as example below:

Code: Select all

$dbq2['idMinor'] = "FOO"; // setting it temp. to demonstrate...
// your way...
echo("<option value=$dbq2[idMinor]selected>$dbq2[idMinor]</option>\n");
/*
 Returns: <option value=FOOselected>FOO</option>
*/

// better...
echo("<option value="$dbq2[idMinor]" selected>$dbq2[idMinor]</option>");
// or
echo('<option value="'.$dbq2['idMinor'].'" selected>'.$dbq2['idMinor'].'</option>');
/*
 Returns: <option value="FOO" selected>FOO</option>
*/

........

Posted: Sun Jan 11, 2004 7:33 am
by apek
i tried both of them Jam...
but still the same...
but when i replace the SQL statement with the simple one like

Code: Select all

Select idMinor from tPartMinor;
theres no problem with it...

but when i replace with the SQL statement with some operation like in my previous post,then the invisible thing happens...

Code: Select all

"Select LEFT(idMinor,1) from ".$DBprefix." tPartMinor where LEFT(idMinor,1)='$minor' group by idMinor";

maybe its the mysql things,but i dunno what...

FYI,the $minor variable comes from the submit form before...(POST operation)...

so pls help me with this...

............

Posted: Sun Jan 11, 2004 7:45 am
by apek
ahaa!!!
i fixed that...
its mysql problem..
i replace the sql statement

Code: Select all

$query2 = "Select LEFT(idMinor,1) from ".$DBprefix." tPartMinor where LEFT(idMinor,1)='$minor' group by idMinor";
with

Code: Select all

$query2 = "Select idMinor from ".$DBprefix." tPartMinor where LEFT(idMinor,1)='$minor' group by idMinor";
then its ok...

but now another problem rise...
the parameter passed from the submit form is wronged and now my combobox only show the same item all time...in fact it should give output chose by user...
you can view my problem details here:
viewtopic.php?t=16536

Posted: Sun Jan 11, 2004 7:51 am
by JAM
Read up on my post again (about how to quote values). I wrote sidenote as it was not about your original problem, but this particular one.

....

Posted: Sun Jan 11, 2004 8:18 am
by apek
jam..for my wrong passed parameter problem........
i tried both of them...

Code: Select all

// better...
echo("<option value="$dbq2[idMinor]" selected>$dbq2[idMinor]</option>");
// or
echo('<option value="'.$dbq2['idMinor'].'" selected>'.$dbq2['idMinor'].'</option>');
/*
Returns: <option value="FOO" selected>FOO</option
but still the same...
the parameter passing is still wrong...

Posted: Sun Jan 11, 2004 11:26 am
by JAM
You get $minor from a form?
If so, are you using $_POST['minor'] or simply $minor whereever it is used?

............

Posted: Sun Jan 11, 2004 11:30 am
by apek
FYI...
i did this at the bottom of the second page...

Code: Select all

$minor = $HTTP_POST_VARS["front"];
hope this will clarify u...