Jump to content

[SOLVED] php output into textarea


Goose87

Recommended Posts

Hi,

 

I have a problem with a personal forum I have created.  I needed to create it myself so it would work with my requirements.

 

I am adding a feature to edit the text of a post that someone has created.  When the edit page is loaded, it is meant to output the text into a <textarea> field.  The php side technically works, but I can't get the whole thing to format properly.  I have a large area of spaces (or tabs) with a return line, approximating to around 100 spaces.  If I don't use the echo "$text"; in there and I put manual text in, I still get this large spaced area.  I also tried ignoring the CSS code, but i STILL have the problem.

 

If anyone has any ideas what this problem could be, could you please point me in the right direction, as I'm extremely frustrated with this problem.

 

Kind Regards,

 

Goose.

Link to comment
https://forums.phpfreaks.com/topic/139262-solved-php-output-into-textarea/
Share on other sites

 

 



<form action="xxxx" method="post" name="edit_post">

<table cellspacing="2px">
  <tr>
    <td bgcolor="#000" align="center" colspan="2">
      Edit Post
    </td>
  </tr>
  <tr>
    <td align="center" colspan="2">

      <textarea class='mail' name="body" cols="50" rows="5" align="left">

        <?php echo "$text"; ?>

      </textarea>

    </td>
  </tr>
  <tr>
    <td bgcolor="#000" align="center" colspan="2">

      <input class="button" type="submit" name="edit_thread" value="Start Thread" />
    </td>
  </tr>
</table>

 

There is a class reference, but this has no effect on the problem when I remove it, so it must be something else...

Please try the below

      <textarea class='mail' name="body" cols="50" rows="5" align="left"><?php echo "$text"; ?></textarea>

 

oh!  Thanks sooo much!  It was such an obvious mistake, but I just needed someone to point it out!  :) w00t!

 

Proves that it doesn't always pay to make your code look neat, as it makes that fail :)

 

Thanks again my friend :D

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.