Ciao ragazzi!
IO ho una form di aggiornamento dati e in un campo della mia tabella voglio fare l'update usando una DropDownList...
come faccio a fargli selezionare il valore che è già presente in quel campo? I dati sono salvati in un DB MySql
Ecco uno spezzone del codice:
if($_REQUEST["op"]=="updateUt" && $_REQUEST["id"] == $fetch->id)//nel caso update ..
{
echo '<tr><form name="upNewUser" method="POST">';
echo '<td><input type="text" name="newCode" value="'.$fetch->code.'" /></td>';
echo '<td><select name="newStatus">
<option value="0" name="0" >0</option>
<option value="1" name="1" >1</option>
<option value="2" name="2" >2</option>
</select></td>';
echo '<td><input type="text" name="newType" value="'.$fetch->type.'" /></td>';
echo '<td width="200"><input type="text" name="newAfmetingen" value="'.$fetch->afmetingen.'" /></td>';
echo '<td width="100"><input type="text" name="newGewicht_en_max_payload" value="'.$fetch->Gewicht_en_max_payload.'" /></td>';
echo '<td><input type="text" name="newKoopjaar" value="'.$fetch->Koopjaar.'" /></td>';
echo '<td><input type="text" name="newVervaldatum" value="'.$fetch->Vervaldatum.'" /></td>';
echo '<td><input type="text" name="newKeuringsdatum" value="'.$fetch->Keuringsdatum.'" /></td>';
echo '<td><input type="text" name="newOnderhoud" value="'.$fetch->Onderhoud.'" /></td>';
echo '<td><input type="text" name="newSchades" value="'.$fetch->Schades.'" /></td>';
echo '<td><input type="text" name="newLeverancier" value="'.$fetch->Leverancier.'" /></td>';
echo '<td><input type="text" name="newFinanciering" value="'.$fetch->Financiering.'" /></td>';
echo '<center><td colspan="2"><input type="submit" value="UpdateContainer" name="UpdateContainer" /></center></td>';
echo "</form></tr>";
Devo modificare la parte rossa in modo che quando clicco su modifica mi lasci come selected value la scelta che c'era già!
Grazie a tutti =)
IO ho una form di aggiornamento dati e in un campo della mia tabella voglio fare l'update usando una DropDownList...
come faccio a fargli selezionare il valore che è già presente in quel campo? I dati sono salvati in un DB MySql
Ecco uno spezzone del codice:
if($_REQUEST["op"]=="updateUt" && $_REQUEST["id"] == $fetch->id)//nel caso update ..
{
echo '<tr><form name="upNewUser" method="POST">';
echo '<td><input type="text" name="newCode" value="'.$fetch->code.'" /></td>';
echo '<td><select name="newStatus">
<option value="0" name="0" >0</option>
<option value="1" name="1" >1</option>
<option value="2" name="2" >2</option>
</select></td>';
echo '<td><input type="text" name="newType" value="'.$fetch->type.'" /></td>';
echo '<td width="200"><input type="text" name="newAfmetingen" value="'.$fetch->afmetingen.'" /></td>';
echo '<td width="100"><input type="text" name="newGewicht_en_max_payload" value="'.$fetch->Gewicht_en_max_payload.'" /></td>';
echo '<td><input type="text" name="newKoopjaar" value="'.$fetch->Koopjaar.'" /></td>';
echo '<td><input type="text" name="newVervaldatum" value="'.$fetch->Vervaldatum.'" /></td>';
echo '<td><input type="text" name="newKeuringsdatum" value="'.$fetch->Keuringsdatum.'" /></td>';
echo '<td><input type="text" name="newOnderhoud" value="'.$fetch->Onderhoud.'" /></td>';
echo '<td><input type="text" name="newSchades" value="'.$fetch->Schades.'" /></td>';
echo '<td><input type="text" name="newLeverancier" value="'.$fetch->Leverancier.'" /></td>';
echo '<td><input type="text" name="newFinanciering" value="'.$fetch->Financiering.'" /></td>';
echo '<center><td colspan="2"><input type="submit" value="UpdateContainer" name="UpdateContainer" /></center></td>';
echo "</form></tr>";
Devo modificare la parte rossa in modo che quando clicco su modifica mi lasci come selected value la scelta che c'era già!
Grazie a tutti =)