Jump to content

Strange Select Problem


scottybwoy

Recommended Posts

Hi All,

I have a problem with my Select, field in my template.  It uses php to recieve the options, which works fine.  Selecting the options is ok except for the first one!  Even if I select another and then select the original.  Here's the code :
[code]
<?php
<label for='type'>Customer Type :</label>
<select action='submit' name='type' tabindex='12'>
<?php
while ($tRow = mssql_fetch_array($sqlT)) { // Loop through each element
if ($tRow[0] == $data_array["type"]) {
echo "<option value='" . $tRow[0] . "' selected='selected'>" . $tRow[1] . "</option>";
} else {
print("<option value='" . $tRow[0] . "'>" . $tRow[1] . "</option>");
}
}
?>
</select>
<div id="inf_type" class='sp'>&nbsp;</div>
<label for='pay'>Payment Method :</label>
<select action='submit' name='pay' tabindex='13'>
<?php
while ($pRow = mssql_fetch_array($sqlP)) { // Loop through each element
if ($pRow[0] == $data_array["pay"]) {
echo "<option value='" . $pRow[0] . "' selected='selected'>" . $pRow[1] . "</option>";
} else {
print("<option value='" . $pRow[0] . "'>" . $pRow[1] . "</option>");
}
}
?>
</select>
?>
[/code]

Array offset [0] is figures, 0, 1, 2 etc.  Whilst offset [1] is the text.  When int '0' is sent via POST is it classed as NULL?  Thanks
Link to comment
https://forums.phpfreaks.com/topic/33748-strange-select-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.