Welcome Guest, Not a member yet? Register   Sign In
Form helper not outputting newline characters.
#1

[eluser]dopple[/eluser]
Hi all. This is my first question on the board since starting to use codeigniter (about 2 or 3 weeks) so I reckon I'm doing pretty well so far.

The code below is outputting the html below that. Why is it all in one line? It's not a massive issue but I'd rather it was a bit more readable than that.

Code:
<?php
$attributes = array(
                'class'     => 'section',
                'id'        => 'section',
            );
              
echo form_open('section/add_section',$attributes);
echo form_label('Section Name', 'name');
echo '<br />';
$data = array(
                'name'      => 'name',
                'id'        => 'name',
                'maxlength' => '30',
                'size'      => '30',
            );
echo form_input($data);
echo '<br />';
echo form_label('Remarks', 'remarks');
echo '<br />';
$data = array(
                'name'      => 'remarks',
                'id'        => 'remarks',
            );
echo form_textarea($data);
echo '<br />';
echo form_submit('submit', 'Save');
echo '<br />';
echo form_close();
?&gt;

Code:
&lt;form action="http://localhost/helpr/index.php/section/add_section.php" method="post" class="section" id="section"&gt;&lt;label for="name">Section Name</label><br />&lt;input type="text" name="name" value="" id="name" maxlength="30" size="30"  /&gt;&lt;br /><label for="remarks">Remarks</label><br />&lt;textarea name="remarks" cols="90" rows="12" id="remarks" &gt;&lt;/textarea><br />&lt;input type="submit" name="submit" value="Save"  /&gt;&lt;br />&lt;/form&gt;            </div>
#2

[eluser]Dam1an[/eluser]
If you want the new line to appear in the source file, use echo "\n" or "\r\n" for UNIX and Windows respectively

When you use echo '<b r />' thats new lines for the rendered page
#3

[eluser]dopple[/eluser]
Thanks Dam1an. I've done just that and it works fine. Mucho Danke!
#4

[eluser]Dam1an[/eluser]
Your welcome Smile




Theme © iAndrew 2016 - Forum software by © MyBB