Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8070047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:16:06+00:00 2026-06-05T13:16:06+00:00

my controller is like this $content = View::factory(‘user/biochemistryTestForm’) ->bind(‘result’, $result); $this->template->content = $content; //here

  • 0

my controller is like this

$content = View::factory('user/biochemistryTestForm')
                  ->bind('result', $result);
            $this->template->content = $content;
   //here $result is array of Datatbase records

in view

<?php echo Form::select('allvalues', $result,null, null) ?>

this tag generate code to browser like this

<select name="allvalues">
<option value="0">Photo</option>
<option value="1">Kishore</option>
<option value="2">Chandrapal</option>
<option value="3">Framework</option>
</select> 

i want to set values to this tag programatically

help me

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:16:08+00:00Added an answer on June 5, 2026 at 1:16 pm

    I’m not sure if I understand the question fully, but I’ll have a stab at answering regardless.

    If you want to set the values of the select options to something other than numeric then you need to assign an array with associative keys to the $result variable in the controller.

    $result = array(
        'photo' => 'Photo',
        'kishore' => 'Kishore',
        'chandrapal' => 'Chandrapal',
        'framework' => 'Framework'
    );
    

    EDIT: I noticed your $result variable is assigned an array from the database, you’ve not posted the code that assigns a value to $result so I’m going take a stab in the dark.

    You need to add ->as_array('key','value') to the end of your Database result call in the controller. The key will be used as the array key, which will become the select option value and the value will be used and the array value which will become the select option label.

    Controller

    $results = DB::select('name')
        ->from('things')
        ->execute()
        ->as_array('name', 'name');
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a controller like this : @Secured(['ROLE_USER','IS_AUTHENTICATED_FULLY']) def userprofile(){ def user = User.get(springSecurityService.principal.id)
I present the view controller like this: FBViewController *fbViewController =[[FBViewController alloc] initWithNibName:@FBViewController bundle:nil]; fbViewController.label.text=@hello;
Not sure what's going on here... My controller methods looks like this: [HttpGet] public
I have a Create-View like this ... <script src=@Url.Content(~/Scripts/jquery.validate.min.js) type=text/javascript></script> <script src=@Url.Content(~/Scripts/jquery.validate.unobtrusive.min.js) type=text/javascript></script> @using
I got a ASP.NET MVC controller like this [Authorize] public class ObjectController : Controller
My controller is like this @RequestMapping(value =/getTaggedProducts, method = RequestMethod.GET) @ResponseBody public String getProductsTagged(@RequestParam(questionnaireId)Long
I have a Controller defined like this: package controllers import play.api._ import play.api.mvc._ import
I'm using Spring MVC and jquery autocomplete, my spring controller looks like this @RequestMapping(value
If your controller action looks like this: respond_to do |format| format.html { raise 'Unsupported'
I have a simple Controller that looks like this:- @Controller @RequestMapping(value = /groups) public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.