Tags down


set textarea value using php

By : I Putu Agus Sri Kresna
Date : May 05 2020, 10:30 AM

I use codeigniter and I'm title value attribute, I have the value from the database clearly displayed in the form on screen. However, the body value attribute is not appearing. Looking in the inspector, I can see the value has all the information from the database but it is not appearing on the screen. I am unclear why one is showing and the other is not. Any help would be appreciated. Below is the code plus screenshot.

Thank you in advance.

code Edit view:

  <?php echo form_open('posts/update'); ?>
  <div class="form-group">
    <input type="text" class="form-control" name="title" placeholder="Add Title" value="<?php echo $post['title']; ?>">
  <div class="form-group">
    <textarea class="form-control" name="body" placeholder="Add Body" value="<?php echo $post['body']; ?>"></textarea>
  <button type="submit" class="btn btn-primary">Submit</button>

Post Controller Edit function:

        public function edit($slug) {
        $data['post'] = $this->post_model->get_posts($slug);
        if (empty($data['post'])) {

        $data['title'] = 'Edit Post';

        $this->load->view('posts/edit', $data);
    public function update() {

The View

<?php echo form_open('posts/edit/' . $post['slug']); ?>
    <input type="submit" value="Edit" class="btn btn-secondary float-left mr-2">

<?php echo form_open('/posts/delete/' . $post['id']); ?>
    <input type="submit" value="Delete" class="btn btn-danger">

enter image description here

Answer :

Welcome , text area is define in outside of the you textarea input value like that.. and text value define in the value section of our input type text and vaue..

   <textarea class="form-control" name="body" placeholder="Add Body"><?php echo $post['body']; ?></textarea>

another code will write like ..

i hope you are well understanding difference between textarea and text input

 <input type="text" value="<?php echo $post['body']; ?>" class="btn btn-secondary float-left mr-2">

Share : facebook icon twitter icon
Related Posts Related Posts :
  • clear array after form submit
  • pass url variable to javascript
  • access data using api
  • div position fixed css
  • add horizontal line between two div
  • disable toggle button css
  • css fixed line height
  • background image not working
  • table cell border
  • text line break css
  • overlay div on div
  • text direction rtl css
  • javascript convert string to an object
  • bind inner div click to outer div
  • jquery ajax oncomplete
  • how to use promise in for loop
  • jquery get element using variable
  • javascript send textbox value
  • pass div class content to another class or id
  • css new line after element
  • css calc not working properly
  • link disabled jquery
  • sql join table to subquery
  • MS Access SQL Issue with OR AND Operators
  • php merge two arrays into one
  • php form with google captcha
  • update current row in php
  • php date format mysql
  • mysql pdo select query
  • php function return an array
  • PHP mysqldump database to sql file
  • display image query
  • php create array using foreach loop
  • associative array php
  • group_concat in mysql laravel
  • php array_push empty
  • mysql on update cascade not working
  • pdo insert prepared statement
  • mysql insert ignore vs on duplicate key
  • mysql insert into existing row
  • mysql multi insert query
  • mysql group by show all rows
  • php change profile image
  • combine multiple arrays into one array php
  • how to sum values in an array
  • how to get sum of the total time
  • How to Create Facebook live stream without notification using API ?
  • on button click make div visible
  • css affect another element on hover
  • insert line after paragraph word
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org