Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
in Q2A Core by
In the select form, in the options section, value always starts at zero. I want to replace the value part with the "id" values I got from the database, but I couldn't.

I made a change in the select function in the qa-theme-base.php file as follows:


    $this->output('<option value="' . $field['index'][$key] . '"' . ($selected ? ' selected' : '') . '>' . $value . '</option>');


    $this->output('<option value="' . $key . '"' . ($selected ? ' selected' : '') . '>' . $value . '</option>');


Please let me know if there is a better way.
Q2A version: 1.8.5
For one thing, you should override form_select() in qa-theme.php of your theme rather than editing a core file. Also, you need to provide more details. What does $field['index'] look like? Is it an associative array with the right keys? Does the code give you errors? If so, what are they?

Please log in or register to answer this question.