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 4539504
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:57:20+00:00 2026-05-21T14:57:20+00:00

I have an issue when I click on a link to edit a sale

  • 0

I have an issue when I click on a link to edit a sale http://domain/admin/editsale/index/21/sale-name I seem to get a blank page loaded so I have a feeling that it is not getting the $id but I cannot spot my issue.

Controller:

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Editsale extends CI_Controller {

    function __construct() {
    parent::__construct();

    }

    function index($id) {
        if(!$this->session->userdata('logged_in'))redirect('admin/home');

        if($this->input->post('submit')) {

            #Set The Validation Rules
                $this->form_validation->set_rules('name', 'Name', 'trim|required');
                $this->form_validation->set_rules('location', 'Location', 'trim|required');
                $this->form_validation->set_rules('bedrooms', 'Bedrooms', 'trim|is_natural');
                $this->form_validation->set_rules('bathrooms', 'Bathrooms', 'trim');
                $this->form_validation->set_rules('condition', 'Condition', 'trim');
                $this->form_validation->set_rules('description', 'Description', 'trim');
                $this->form_validation->set_rules('price', 'Price', 'trim');

            if($this->form_validation->run() == FALSE) {

                #Set the $data for the view if FALSE
                $data['cms_pages'] = $this->navigation_model->getCMSPages($id);
                $data['sales_pages'] = $this->sales_model->getSalesPages($id);
                $data['sale'] = $this->sales_model->getSalesContent($id);
                $data['content'] = $this->load->view('admin/editsale', $data, TRUE); #Loads the "content"

                $this->load->view('admintemplate', $data); #Loads the given template and passes the $data['content'] into it
            }

            #Form Validation Was Correct So Lets Continue 

            #Lets Set What We Are Sending To The DB
                    $content = array(
                    'name' => $this->input->post('name', TRUE),
                    'location' => $this->input->post('location', TRUE),
                    'bedrooms' => $this->input->post('bedrooms', TRUE),
                    'bathrooms' => $this->input->post('bathrooms', TRUE),
                    'condition' => $this->input->post('condition', TRUE),
                    'description' => $this->input->post('description', TRUE),
                    'price' => $this->input->post('price', TRUE)
                    );

                    if($this->sales_model->updateSale($id, $content)) {
                            $data['success'] = TRUE; #displays sale updated
                            $data['cms_pages'] = $this->navigation_model->getCMSPages($id);
                            $data['sales_pages'] = $this->sales_model->getSalesPages($id);
                            $data['sale'] = $this->sales_model->getSalesContent($id);
                            $data['content'] = $this->load->view('admin/editsale', $data, TRUE); #Loads the "content"
                } // Sale Update End
                    }else{ 
                $data['cms_pages'] = $this->navigation_model->getCMSPages($id);
                $data['sales_pages'] = $this->sales_model->getSalesPages($id);
                $data['sale'] = $this->sales_model->getSalesContent($id);
                $data['content'] = $this->load->view('admin/editsale', $data, TRUE); #Loads the "content"
                }#Submit End    
        } #Index End
}

Model:

function getSalesPages($id = NULL) {
    $query = $this->db->get('sales');
    if($query->num_rows() > 0) return $query->result();

}

function getSalesContent($id = NULL) {
    $this->db->where('id', $id);
    $query = $this->db->get('sales', 1);

    if($query->num_rows() > 0) {
        $row = $query->result_array();
        return $row;
    }else{
        return FALSE;
    }
}

View:

<?php
//Setting form attributes
$formEditSale = array('id' => 'editSale', 'name' => 'editSale');
$formName = array('id' => 'name', 'name' => 'name');
$formLocation = array('id' => 'location', 'name' => 'location');
$formBedrooms = array('id' => 'bedrooms','name' => 'bedrooms');
$formBathrooms = array('id' => 'bathrooms','name' => 'bathrooms');
$formCondition = array('id' => 'condition','name' => 'condition');
$formDescription = array('id' => 'description','name' => 'description');
$formPrice = array('id' => 'price','name' => 'price');

if($success == TRUE) {
echo '<section id = "validation">Sale Updated</section>';   
}
?>

?>

<section id = "validation"><?php echo validation_errors();?></section>

<?php
echo form_open_multipart('admin/editsale/index/'.$sale[0]['id'].'/'.url_title($sale[0]['name'],'dash', TRUE),$formEditSale);
echo form_fieldset();
echo form_label('Name:', 'name');
echo form_input($formName, $sale[0]['name']);
echo form_label ('Location', 'location');
echo form_input($formLocation, $sale[0]['location']);
echo form_label ('Bedrooms', 'bedrooms');
echo form_input($formBedrooms, $sale[0]['bedrooms']);
echo form_label ('Bathrooms', 'bathrooms');
echo form_input($formBathrooms, $sale[0]['bathrooms']);
echo form_label ('Condition', 'condition');
echo form_input($formCondition, $sale[0]['condition']);
echo form_label ('Price', 'price');
echo form_input($formPrice, $sale[0]['sale']);
echo form_label ('Description', 'description');
echo form_textarea($formDescription, $sale[0]['description']);
echo form_submit('submit','Submit');
echo form_fieldset_close();
echo form_close();
  • 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-05-21T14:57:21+00:00Added an answer on May 21, 2026 at 2:57 pm

    Fixed, I was loading the view before the data

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

Sidebar

Related Questions

I have implemented jquery on the site (click on the plus sign) http://pligg.marsgibson.info Issue
I have one issue with UInavigationcontroller In my firstview i have button.If i click
I have an issue with jquery and history.back(): I got a link: <a href=#
I seem to have an issue when creating copies of a template and tying
Currently, I have a link to a powerpoint file and when you click the
Edit: Sorry guys, I got the issue, Misspelled class name :( Hey, I got
http://jsfiddle.net/HVGre/1/ - test link. I have an html link on my page that I
I'm running into an issue now where I have a random link on my
I have issue with: <form:checkboxes path=roles cssClass=checkbox items=${roleSelections} /> If previous line is used
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So

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.