Textarea is not displaying user data
-
Hi,
I am trying to make a form which is editable by user and if user already have added some text, it should show that. Once user press submit button, text should be replaced with new text which is input by user. I am facing strange issue. In textarea when I input new text, its get registered into user metadata table, but same is not display into the textarea. But if I echo same outside text area it will display updated text.
I am using following code for textarea
<textarea id="fieldname" name="fieldname" placeholder="Write Some Text here" class="form-control" style="margin-bottom: 10px; width: 100%"><?php if($edit){ echo $user_info->fieldname;}elseif(isset($_POST['fieldname'])) echo $_POST['fieldname'];?></textarea>
`
Above code I am able to submit the new text and same is registered into database table, but it is not showing back if user had previously added some text in this field.
But when i echo following code on same page, it gives updated output
<?php echo $user_info->fieldname;?>
Any thoughts what is missing or stopping text to display in textarea itself ?
- The topic ‘Textarea is not displaying user data’ is closed to new replies.