rodo Posted August 10, 2013 Share Posted August 10, 2013 Hello everyone, this is my first post..jeje I've a problem with a simple dropdown, the dropdown is populated with mysql table, and everything works fine, but when I use the submit button, in the save.php doesn't get the first choice of the dropdown! if I select 2nd o 3rd or other..it works..but when I choose the first it return empty.. here my code: EDIT.PHP <div class="form-row row-fluid"> <label class="form-label span4" for="tipoproveedor">Tipo Proveedor</label> <div class="span7 controls"> <select name="selectTipoProveedor" id="selectTipoProveedor"> <option VALUE=<? while ($rowTipoProveedor=mysql_fetch_array($resultTipoProveedor)){ if($rowTipoProveedor['ClaTipoProveedor'] == $row->ClaTipoProveedor) echo '<option selected="selected" value='.$rowTipoProveedor['ClaTipoProveedor'].'>' .$rowTipoProveedor['NomTipoProveedor']. '</option>'; else echo'<option value='.$rowTipoProveedor['ClaTipoProveedor'].'>'.$rowTipoProveedor['NomTipoProveedor'].'</option>'; }?> </option> </select> </div> </div> SAVE.PHP .... $tipoprov = $_POST[selectTipoProveedor]; $test = "<h2 class=>".$tipoprov."</h2>"; ... Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/281025-dropdown-error-first-choice/ Share on other sites More sharing options...
Solution litebearer Posted August 10, 2013 Solution Share Posted August 10, 2013 Effectively, you are placing an <option></option> within an option. Your while loop should begin immediately after your opening select and end immediately prior to your closing select. If you look closely at your browser source you should see what is happening Quote Link to comment https://forums.phpfreaks.com/topic/281025-dropdown-error-first-choice/#findComment-1444323 Share on other sites More sharing options...
rodo Posted August 10, 2013 Author Share Posted August 10, 2013 litebearer, u re right...thanks for your time... Quote Link to comment https://forums.phpfreaks.com/topic/281025-dropdown-error-first-choice/#findComment-1444326 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.