Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8308823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:55:23+00:00 2026-06-08T18:55:23+00:00

I am trying to make an edit page where the form fields are populated

  • 0

I am trying to make an edit page where the form fields are populated from the database. I’m trying to get it working by just setting some random text, but I’m having trouble making it show.

I have the following in my controller:

public function edit($item_id) {

    $this->data['title'] = "Edit Item";

    $this->data['item_title'] = array(
        'name' => 'item_title',
        'id' => 'item_title',
        'type' => 'text',
        'value' => 'a title',
      );

      $this->data['url_slug'] = array(
        'name' => 'url_slug',
        'id' => 'url_slug',
        'type' => 'text',
        'value' => 'some-url-slug',
      );

    $this->template->build('admin/item/form', $this->data);
  }

This is my view:

<?php echo form_open('admin/item/update_item', array('id' => 'item_form')); ?>

<input type="text" name="item_title" value="<?php echo set_value('item_title'); ?>" id="item_title" placeholder="Enter a title..."/>

<input type="text" name="url_slug" value="<?php echo set_value('url_slug'); ?>" id="url_slug" placeholder="url-slug-of-the-item"/>

When I go the /edit/id page, the placeholder is still showing and the value is blank. Why is not setting? It works fine when I use it for form validation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:55:24+00:00Added an answer on June 8, 2026 at 6:55 pm

    I ended up ditching the array and just doing $this->data['item_title'] = 'some title'; in the controller, and in the the view, set_value actually accepts a 2nd parameter, like this:

    <?php echo set_value('item_title', $item_title); ?>
    

    This does the trick, although I do get warnings if the variable doesn’t exist, so I need to declare them all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i`m trying to make an NSMutableArray From NSUserDefaults so i can add/delete and edit
I am trying to make a edit profile page and i want the user
OK. I just tied myself in a knot trying to make a form in
Im trying to use css to make all the fields for my form display
I'm trying to make a view where the user can edit DB records through
I am trying to make a row in a table link to the edit
I'm trying to edit this submit tag to make it disable itself once I
Trying to make the infamous checkall checkbox for dynamically created rows from a MySQL
I'm trying to make a web page that only has content within the page
I'm creating a form in one page, then in another page I'm trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.