0

I'm trying to pull some html data from a mysql database to populate a text area.

I'm doing some tests with the home page content data and it only displays the last half of the html code I'm trying to select.

I can't wrap my head around all this problem!

Here is the textarea code I'm trying to use:

 <textarea style='width:600px;height:300px;' name='' value='<?php
                mysql_connect("localhost", "root", "") or die(mysql_error());
                mysql_select_db("cgscms") or die(mysql_error());
                $sql = 'SELECT * FROM content where page_id ="1"';
                $result = mysql_query($sql);
                while($row = mysql_fetch_array( $result )) {
                    echo $row['content'];
                }

 ?>'></textarea>
1
  • 1
    Take the text area out of the equation. What do you get if you echo the content into a div or p tag? Furthermore, is the field in the db big enough to hold your content or is it truncated in the db? Commented Jan 9, 2012 at 0:47

1 Answer 1

6

Text area doesn't use Value. Try putting it between the textarea tags

 <textarea> put it here </textarea>

But another thing is if there are any quotes it will interfere with the quotes around value=""

Wrap the content result with htmlentities()

Sign up to request clarification or add additional context in comments.

1 Comment

Just realised this was the case as soon as the question got migrated! Thanks a lot mate!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.