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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.