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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.