I have this code which for each question it founds in the database it generates a Label, and then for each label generated it generates 5 buttons.
And i have this question
How can i make the radio buttons appear next to the label generated(Inline)
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\Preguntas;
use yii\db\ActiveRecord;
use app\models\Respuestas;
use app\models\Encuestas;
/* @var $this yii\web\View */
/* @var $model app\models\Encuestas */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="encuestas-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'titulo')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'objetivo')->textInput(['maxlength' => true]) ?>
<?php $data = Encuestas::find()->all(); ?>
<?php $Respuestas = Respuestas::find()->all();?>
<div style='display:inline-block'>
<?php
foreach (Preguntas::find()->all() as $pregunta) {
$data = $pregunta->preguntas;
echo "<br>";
echo $label = Html::label(
$data, 'Pregunta',
['class' => 'control-label', 'style' => 'vertica-align:top']
);
echo "<br>";
?>
<?php
foreach ((object) $label as $radio) {
echo Html::radio('nunca', true, ['value' => 1]);
echo Html::radio('ocasionalmente', true, ['value' => 2]);
echo Html::radio('normalmente', true, ['value' => 3]);
echo Html::radio('casi siempre', true, ['value' => 4]);
echo Html::radio('siempre', true, ['value' => 5]);
}
}
?>
<hr>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
I apologize for the bad english.
Thanks for your help