JulianJ
JulianJ

Reputation: 1309

Why can I not edit my form's text field?

I have a form that I'm using within Twitter Bootstrap 3. The form posts data to a mysql database and the placeholder values are echoed from the database. I have used a <textarea> input in the 'bio' field but for some reason the placeholder text behaves differently here. I can't drop a cursor and edit a particular word like I can with the other fields. Why is this?

<div class="form-group">
    <form class="" action="" id="edit_profile" method="post">
        <label>
                Name
              </label>
        <input id="user_name" name="user_name" type="text" placeholder="<?php echo $user_name ; ?>" value="<?php echo $user_name ; ?>" class="form-control input-md" required="">
</div>
Email
</label>
<input id="user_email" name="user_email" type="text" placeholder="<?php echo $user_email; ?>" value="<?php echo $user_email; ?>" class="form-control input-md" required="">
</div>

Bio
</label>

<textarea style="width:100%" value="<?php echo $bio; ?>" placeholder="<?php echo $bio; ?>" name="bio"></textarea>
</div>
<input type="hidden" name="user_id" value="<?php echo $_SESSION['user_session'] ?>">

<button type="submit" class="btn btn-small btn-green pull-right" id="submit">

              Save
            </button>
</form>

Upvotes: 3

Views: 3154

Answers (1)

junkfoodjunkie
junkfoodjunkie

Reputation: 3178

Textarea-text does not go in the value= it goes between the <textarea><?php echo $bio; ?></textarea> tags.

<textarea placeholder="This is a placeholder">This is the actual text</textarea>

You cannot have a value= on a <textarea> since it will stay the same regardless of what you put inside the <textarea> and therefore won't change anything regardless of what you type. (Try removing the "This is the actual text" in the example)

Upvotes: 6

Related Questions