0
I have a form and I want to send the questions and answers to a database. I took the question in text form and sent it to a field input Hidden and I want to put the question and the answer in the database:
<label for="pergunta">Como programar em PHP?</label>
<input type="hidden" name="pergunta[]" value="Como programar em PHP?" />
<input type="text" name="resposta[]" value="Estude na documentação do PHP.net" />
There are several questions fed by a foreach. How to iterate the questions with the answers and get something like:
How to program in PHP? Study the PHP.net documentation
I thought of something like:
$pergunta = $_POST["pergunta"]; // vai retornar um array
$resposta = $_POST["resposta"]; // vai retornar um array
foreach(){
}
There would be several questions and answers at the same time?
– Sr. André Baill