简体   繁体   中英

How to process multiple html form values in php

I'm doing a survey form in php. For each question there are 3 answer options, only 1 can be selected, so doing radio buttons for input values with the same name. I believe I am using an array for these values unless I botched the syntax.

How do I load these selected values using POST form values, per question, in to my sql db answers table?

A simple iteration over this POST form array outputs nothing, so what am I missing?

Thanks!

while ($row = mysqli_fetch_assoc($result))
{
   echo '<p>'.sprintf($row['question'],$partner_name);
   echo 'Yes<input type="radio" id="'.$row['question_id'].'" name="'.$row['question_id'].'[]" value="Yes">';
   echo 'Maybe<input type="radio" id="'.$row['question_id'].'" name="'.$row['question_id'].'[]" value="Maybe">';
   echo 'No<input type="radio" id="'.$row['question_id'].'" name="'.$row['question_id'].'[]" value="No">';
   echo '</p>';
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM