0
function display_questions() {
        $lines = file('questions.txt', FILE_IGNORE_NEW_LINES);
        $count = count($lines);

        for ($i = 0; $i < $count; $i++) {
            $newLines = explode(",", $lines[$i]);           
            $no_question = $i + 1;          
            ECHO ('<b>' .$newLines[0]. '</b><br />');
            ECHO ('<input type="radio" name="' .$no_question. '" value="' .$newLines[1]. '/>' .$newLines[1]. '<br />');
            ECHO ('<input type="radio" name="' .$no_question. '" value="' .$newLines[2]. '/>' .$newLines[2]. '<br />');
            ECHO ('<input type="radio" name="' .$no_question. '" value="' .$newLines[3]. '/>' .$newLines[3]. '<br />');
            ECHO ('<input type="radio" name="' .$no_question. '" value="' .$newLines[4]. '/>' .$newLines[4]. '<br />');
            ECHO ('<br /><br />');
        }
    }

Here is my questions.txt file look like

  1. Please select the answer of 5 x 2, 7, 10, 3, 5
  2. Please select the answer of 5 + 2, 7, 10, 3, 5
  3. Please select the answer of 5 - 2, 7, 10, 3, 5
  4. Please select the answer of 25 x 2, 50, 23, 27, 15
  5. Please select the answer of 12 x 2, 10, 6, 14, 24

I wanted to ECHO the radio inputs and those information are gather from the questions.txt.
However, I am success to ECHO $newLines[0], but I can't ECHO the radio button.
Please advise. Thanks.

1
Contributor
1
Reply
11
Views
2 Months
Discussion Span
Last Post by gahhon
2

I am missing the double quote at ECHO statement. That's how I can't get the radio button display.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.