Tengo esta tabla que tiene nformación de la base de datos.
El problema es que cuando trato de colocar en td las coloca abajo o a la derecha de la primera.
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\Preguntas;
use yii\db\QueryBuilder;
use yii\db\Query;
use yii\db\ActiveRecord;
use app\models\Respuestas;
use app\models\Encuestas;
use yii\grid\GridView;
use yii\data\ActiveDataProvider;
/* @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
$rows = (new \yii\db\Query())
->select(['preguntas'])
->from('tbl_preguntas')
->all();
?>
<?php $rowst = (new \yii\db\Query())
->select(['*'])
->from('tbl_respuestas')
->all();
?>
<table class="table table-bordered">
<thead>
<tr>
<th> </th>
<?php foreach ($rowst as $col) {
echo $label = "<th>".$col['respuesta']."</th>";
}
?>
</tr>
</thead>
<tbody>
<tr>
<td style='color:black;font-weight:bolder'><?php foreach ($rows as $col) {
echo "<br>".$col['preguntas']."<br>";
}?></td>
<?php foreach ($rowst as $rad) {
$radioa = $form->field($model, 'titulo')->radio();
$radiob = $form->field($model, 'id')->radio();
echo "<td>".$radioa."</td>";
} ?>
</tr>
</tbody>
</table>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>