Jump to content

Records do not display as paragraphs


Datnigz2002

Recommended Posts

I am kind of lost here. I am using Dreamweaver's update record feature. In my input field...  If I type the following...

 

"Todays date, My Name

 

My issues

 

Please call"

 

On the page that pulls the info it looks like:

 

"Todays date, My Name, My issues Please call"

 

It doesn't recognize the returns for each line.

 

How can I get it to display as it should without displaying it within an ugly giant input text box?? (Which does work however)

Link to comment
https://forums.phpfreaks.com/topic/101613-records-do-not-display-as-paragraphs/
Share on other sites

The reason is because HTML doesn't recognize new line characters. You can do one of the following:

 

-use PHP to add <BR> tags with nl2br()

-use PHP to manually replace new lines with <BR> tags using str_replace() or similar

-wrap it in <pre> tags

if you use < p r e > (spacing it so it won't crap out again) in conjunction to my previous comment, you will not need to add < b r /> to each line., so it would go something like this:

<pre>
"Todays date, My Name\n
\n
My issues\n
\n
Please call"\n
\n
On the page that pulls the info it looks like:\n
\n
"Todays date, My Name, My issues Please call"
</pre>
//just as he said, pre works best

 

 

This is for end users to enter information to a database and I don't want to have them add html commands in their information.

 

How exactly will I be able to use the PHP methods. I have never done this before and don't know where to start. I just need it for a small page that displays the paragraphs in a table.  Just as you see my lines while your reading this now is what I'm looking for.

 

Thanks

This is for end users to enter information to a database and I don't want to have them add html commands in their information.

 

How exactly will I be able to use the PHP methods. I have never done this before and don't know where to start. I just need it for a small page that displays the paragraphs in a table.  Just as you see my lines while your reading this now is what I'm looking for.

 

Thanks

have your text field automatically add the < p r e> before and < / p r e > at the end of all posts. they won't need to do it.

You use it when you echo out the post. If, for exampe, you have a loop echoing out the forum posts and the variable is called $post, you'd just do:

 

echo nl2br($post);

 

Without any of your code, i can't really help you beyond that.

 

 

Sorry if I sound a little slow but I'm knew to this. I don't know where to put it in. This is what I have for my form. Can you show me where it goes. Then Maybe I will understand why it goes there. (:

 

 

 

<form action="<?php echo $editFormAction; ?>" id="tstest" name="tstest" method="post">

          <div align="center">

            <table width="636" border="0">

              <tr>

                <td height="24"><label>

                <input name="support" type="checkbox" id="support" value="Yes" <?php if (!(strcmp($row_user_lookup['Support'],"Yes"))) {echo "checked=\"checked\"";} ?> />

                  </label>

                  ITHelp Thread   | 

                  <label>

                    <input name="imac" type="checkbox" id="imac" value="Yes" <?php if (!(strcmp($row_user_lookup['IMAC'],"Yes"))) {echo "checked=\"checked\"";} ?> />

                  </label>

                  Configuration Thread

                   |   Created By:

                  <select name="creator" id="creator">

                    <?php

You dont use it on your form. I assume your form continues and you have a textarea somewhere? And this is the field you're having trouble with?

 

You use it when you output the data, that is, after it has been submitted and stored in the database.

I see so are you saying this the code would go in the page that is displaying the data from that particular field?  This is what the code looks like around where the data shows up on the page.

 

      <td colspan="2" bgcolor="#E1E1E1" class="style30">

        <div align="center">

          <table width="606" border="0" cellspacing="2" cellpadding="2">

            <tr>

              <td><div align="left"><?php echo $row_keywords['Ticket']; ?>

                <label></label>

              </div></td>

            </tr>

                  </table>

 

I tried playing around with the echo you see but just not getting it.

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.