Hi guys I have been trying to do this for sometime. Would you please give me an insight on how to go about this. I have a text file containing questions and their respective multiple choice answer spaced using space bar between each element. I have been able to read and put the text file lines into arrays. But now what has prooved difficult to achieve is how to put each and every element to an html form element. these are my codes:
Text file:
Number Question (a) (b) (c) (d) 1 The most important feature of spiral model is requirement analysis. risk management. quality management. configuration management. 2 The worst type of coupling is Data coupling. control coupling. stamp coupling. content coupling. 3 One of the fault base testing techniques is unit testing. beta testing. Stress testing. mutation testing. 4 A fault simulation testing technique is Mutation testing Stress testing Black box testing White box testing 5 RS is also known as specification of White box testing Stress testing Integrated testing Black box testing
The page that reads the text file:
`html>
<head>
<title>read</title>
</head>
<body>
<b><u> QUESTIONS AND ANSWERS QUIZ</u></b <br />
<p>
<?php
$openFile = fopen("questionandanswers.txt", "r") or exit ("unable to open the text file");
$fileContents = fread($openFile, filesize("questionandanswers.txt"));
fclose($openFile);
$delimiter = " ";
$myArray = explode($delimiter, $fileContents);
print_r($myArray);
?>
</p>
</body>
</html>`
THe print_r displays the following:
Array ( [0] => Number [1] => Question [2] => (a) [3] => (b) [4] => (c) [5] => (d) 1 [6] => The most important feature of spiral model is requirement analysis. [7] => risk management. [8] => quality management. [9] => configuration management. 2 [10] => The worst type of coupling is [11] => Data coupling. [12] => control coupling. [13] => stamp coupling. [14] => content coupling. 3 [15] => One of the fault base testing techniques is [16] => unit testing. [17] => beta testing. [18] => Stress testing. [19] => mutation testing. 4 [20] => A fault simulation testing technique is [21] => Mutation testing [22] => Stress testing [23] => Black box testing [24] => White box testing 5 [25] => RS is also known as specification of [26] => White box testing [27] => Stress testing [28] => Integrated testing [29] => Black box testing )