PDA

View Full Version : How to create a line break in PHP



Harold Mansfield
11-30-2010, 04:25 PM
I have a problem with some PHP code in trying to style a form.

Everything I try, breaks the output.
Here is the code:

if ($this->options['display_options']['phone_number']):
_e('and my phone number is', SB_NAME); ?>
<input type="tel" spellcheck="false" autocapitalize="off" name="phone" id="newticket_phone" value="" class="validate[required] w115">.
<?php endif;


if ($this->options['display_options']['priority']):
_e(' 5. I would classify<br> this as a', SB_NAME); ?>
<select name="priority" id="newticket_priority" class="validate[required]">
<?php sbUtils::dropdown($this->options['priority_levels'], __('- choose one -', SB_NAME)); ?></select>
<?php _e('priority', SB_NAME); ?>.
<?php endif;

The problem is, as is, it outputs the lines strung together.


4. My best email is and my phone number is __________. 5. I would....

I need to start a new line so that they aren't.


4. My best email is and my phone number is_______.

5. I would ...

Can anyone help on this?

vangogh
12-01-2010, 12:12 PM
In general use echo "/n"; where you need a line break for the html or echo "<br />"; when you need it for the output of the html.

It looks like you're using someone else's class, which isn't leaving you a place to add either since you would want them after the </option> I think. You might be able to look at the current output and see if you can use css, maybe option {display: block} or something similar. If not perhaps the class itself allows you to pass some additional information in sbUtils::dropdown.

I see a <br> in _e(' 5. I would classify<br> this as a', SB_NAME); so perhaps adding <br /> to the end before the parenthesis would work.

Harold Mansfield
12-01-2010, 06:43 PM
I tried the traditional line breaks and it kept breaking it.
Looks like some creative placement of break tags inside the text area designations along with some editing of the text itself is the way to go and seems to be working.
It's not perfect, but I'll over compensate with something else.