html - Output in a form format that can be submitted after reading from a text file -


i have following text file:

$string =  '1 important feature of spiral model is: requirement analysis. risk    management. quality management. configuration management 2 worst type of coupling is: data coupling. control coupling. stamp coupling. content coupling 3 1 of fault base testing techniques is: unit testing. beta testing. stress testing. mutation testing 4 fault simulation testing technique is: mutation testing. stress testing. black box testing. white box testing 5 rs known as: specification of white box testing. stress testing. integrated testing. black box testing 6 name: collins. achieng. ogwethi. kamanda'; 

the following codes read text file , output in form format pull down menu select multiple question. how i'm trying go it,

<html> <head> <title>read</title> </head> <body>     <b><u> questions , answers quiz</u></b> <br /><br /> <?php $openfile = fopen("questionandanswers.txt", "r") or exit ("unable open text       file"); $string = fread($openfile, filesize("questionandanswers.txt"));  //regex first number string's end, ignore number     question... bit; preg_match('/\d.*/', $string, $match);  //we strings starting number until finds number (which beginning of question; preg_match_all('/\d\d*/', $match[0], $results);  $qas = array(); // prepare array questions/answers foreach($results[0] $result){ //separating answer string answers. list($question, $all_answers) = explode(':', $result);  //separating different answers $answers_array = explode('.', $all_answers);  //stuffing question , array answers prepared   array; $qas[] = array('question' => $question, 'answers' => $answers_array); } ?> <form name="processor" action="processor.php" method="post"> <?php //looping through array , outputting info form; foreach($qas $k => $v)?> echo "<label>{$v['question']}</label><br/>"; echo "<select name='answers[]'>";  //we loop through $v['answers'] because array within array    answers. foreach($v['answers'] $answer) {     echo "<option>$answer</option>";//the output } echo "</select>"; echo "<br/><br/>"; ?> <input type="submit" value="submit"> </form> </body> </html> 

i want able submit output php file processes output $_post. can assist me through this?

i think have correct line:

echo "<select>"; 

to:

echo "<select name='answers[]'>"; 

in processor.php file able select answers array:

var_dump($_post['answers']) 

but should rethink line seems corrupt document model:

<input type="text" name="question" value="<? 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -