7

I have a textarea I use as a form on a website.

I usually use place "placeholder" text inside, but I need this information to come up editable.

What I used to do was just feed info from my database into the "value" attribute of the form. The form would then just pop up with my data, ready to be edited.

For some reason though its not working with my textarea!

Here is my code:

<textarea value='<?php echo $info?>' class="form-control" id="message" name="message"  rows="5"></textarea>

I know its not the data because iv echoed it elsewhere and its fine. I also tried

<textarea value='hi' class="form-control" id="message" name="message"  rows="5"></textarea>

with nothing showing up.

Whats going on ? I used to do this all the time. Im using bootstrap 3, could it have something to do with that ?

4 Answers 4

14

<textarea> tag doesn't have value attribute http://www.w3schools.com/tags/tag_textarea.asp Content should be placed between opening and closing tags

<textarea class="form-control" id="message" name="message"  rows="5">hi</textarea>
Sign up to request clarification or add additional context in comments.

Comments

2

In order to put some text in a textarea you should write something like

<textarea class="form-control" id="message" name="message"  rows="5">hi</textarea>

or

<textarea class="form-control" id="message" name="message"  rows="5">
     <?php echo $info ?>
</textarea>

1 Comment

@YannDìnendal It's not specially the yours, just when I see the original post and what it has become, I prefer rollback to the original state.
0

text area does not have value, put the text between opening and closing tags for example

<textarea name="myText">
this is text area
</textarea>

Comments

0

<textarea name="message"  rows="5">
    <?php echo $variable_or_any_php_code?; >
</textarea>

1 Comment

and your php statement is also have an error.. make sure to correct it too.

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.