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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.