0

So i want to output a title of a document and some text after it from my CSV file!..

But i keep getting the format for the title/$line_of_text[0] :

for where i want the un-fomated text still nesting around the text/$line_of_text[3] should be!

<?PHP
    $file_handle = fopen("test.csv", "r");
    while (!feof($file_handle) ) {
        $line_of_text = fgetcsv($file_handle, 1024);
        print "<h2>" . $line_of_text[0] . "</h2></div>\n" . $line_of_text[3] . "<br>";
    }
    fclose($file_handle);
?>

So this is how i want it to output :

<h2>Title</h2></div>
The main text
<br>

But this is what i get :

<h2>Title</h2></div>
<br><h2>The main text</h2></div>
<br>

So obviously im getting a loop that i dont understand!.

Link where i found this code : http://www.homeandlearn.co.uk/php/php10p6.html

5
  • What do you want to output exactly in html ? Commented Jul 27, 2016 at 8:49
  • <h2>Title</h2></div> The main text <br> Commented Jul 27, 2016 at 9:00
  • Do it with out loop? Commented Jul 27, 2016 at 10:59
  • @rad11 It dont need to be a loop!.. just pick up those 2 things!.. The end :) Commented Jul 27, 2016 at 11:34
  • Ok i tried another code and it worked!.. Solution Commented Jul 27, 2016 at 12:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.