I have a form and I want to send the questions and answers to a database. I took the question in the form of text and sent it to an input hidden field and I want to insert the question and 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" />
You have 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(){
}