• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need experts help

Hi guys

I my view page am populating schools drop down box so i want to make particular options to selected(default)
I can do this in javascript but the thing is, am passing value from controller to model to query the result, value means like schoolName ='troy';

Because In controller am hardcoding the schoolName value,so the worry is suppose if hardcoding schoolName value is not present in schools drop down

Am not posting whole thing
function getdata(){
if(roleID == 'ADMIN')
$schoolName = 'TROY'; //hardcoding schoolName value Admin he dint belongs any school
$schoolName = $this->gethelperfile();
function show($schoolName)
data[res] = $this->Msub->getAlldate($schoolName);

function reload(){
$schoolName = $_post['$schoolName'];
$schoolName = $this->uri->segment(3);

view page
<select id='sc' name='sc'>
foreach($value as $obj){
echo "<option value='".$obj['sname']."'>".$obj['sname']."</option>";
echo "

is there any way to get drop down default selected value to controller to avoid hardcoding the schoolName value when the page gets loading

I want like this

Admin he dint belongs any school he can able to see all schools

but my senior said if U make ALL option the data is too large its take much time to load.

so am not removing all option but when the page get loads am going make default school.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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