• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[HELP] Keep a Select Box Selected after Submit

#1
[eluser]C_Line[/eluser]
i have a code like this

Code:
<select name="pilih_notran">
&lt;?php
$i=0;
foreach($query as $no)
{
$nos[$i] = $no->notrans_supplier;
$p = $_SESSION['psan'];
echo "<option id='$i' value='".$no-&gt;notrans_supplier ."' if($p == $nos[$i]){selected = 'selected';}>".$no->notrans_supplier."</option>";
$i++;
}
?&gt;
</select>

but why it can't selected ?
thx

#2
[eluser]CroNiX[/eluser]
Try using form_dropdown(). CI does all of that for you, and it's much cleaner.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.