Jump to content

[SOLVED] PHP Novice! How can I insert a line break in the code?


iconicCreator

Recommended Posts

I am practicing to have random images display on my page when the page is refresh or reloaded.

 

This is just the part of the code I'm trying to add a line break to.

 

<?php
$images = array(
  array('file'    => 'image1',
        'caption' => 'Good morning, my name is Rick, how may I help you?'),
  array('file'    => 'image2',
        'caption' => 'Good morning, my name is Dianna, how may I help you'),
  array('file'    => 'image3',
        'caption' => 'Good morning, my name is David, how may I help you'),
  array('file'    => 'image4',
        'caption' => 'Good morning, my name is Mary, how may I help you'),
  );
$i = rand(0, count($images)-1);
$selectedImage = "images/{$images[$i]['file']}.png";
$caption = $images[$i]['caption'];
?>

 

 

I feel dumb asking this but I have tried and cannot get it to work with out trying to add an html line break in the html code.

 

I need the return text to the browser to look like this.

 

Good morning,

My name is blah blah, how can I help you?

 

Right now it's just all on one line.

 

How can I add a line break in here?

 

Thanks for your help!

 

IC

Use <PRE>?

 

Actually, I just inserted a break tag within the script and because this file is within an include folder, it can actually be display as a break within the html page.

 

Thanks anyway, I really appreciate your time and efforts.

 

IC

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.