popular within the mysql textarea for the form

Asked

Viewed 158 times

0

public function geraFormTipo1(){

    return
<<<EOT

        <div class="questao-{$this->objQuestoes->numQuestao()}" {$this->isHide}>
            {$this->label()}
            <table class="table tabela-modelo-1">
            {$this->estruturaMain()}
            </table>
            Justifique sua resposta
            <textarea  name="resposta{$this->objQuestoes->numQuestao()}"><?php echo \$resposta{$this->objQuestoes->numQuestao()} ?></textarea>
        </div>


EOT;
}

I gave one echo in the return string of the method geraFormTipo1() and printed on HTML. When I finished the html after printing, I realized that inside the textarea became populated as: <?php $respostaA ?>. The intention was that in the future I would popular the database data for the html, or is the variable that was to be returned (from the database to html) is being printed in the textarea, what is wrong.

what I must do to fix my code?

for example: I had it printed inside the index.php

$formulario = $new Questionario($objQuestoes);
$formHTML = $formulario->geraFormTipo1();

echo formHTML;



<textarea name="respostaA"><?php $respostaA ?></textarea>
  • would popular from the bank to html in the future.
  • the text field of my textarea is printing <?php $respostaA ?>
  • your file has php extension? Are you using any framework? Which is your server, Apache or php -S?

  • I am not using framework and the extension is in php. I am using apache.

  • Using xampp in Windows or manual installation (LAMP)?

  • I am using xampp in windows. I tried to host on the site, and gave the same thing, the tags are being printed in the textarea

1 answer

0

Try it this way, maybe I typed something wrong, I didn’t test it, but you can understand the idea

Return"
objQuestoes->numQuestao()}' {$this->isHide}>
{$this->label()}
{$this->structureMain()}
Justify your answer objQuees->numQuestao()}'>Answer
{$this->objQuestoes->numQuestao()} ";

Browser other questions tagged

You are not signed in. Login or sign up in order to post.