Search Results

Search found 981 results on 40 pages for 'codeigniter'.

Page 14/40 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Codeigniter: Simple ajax submit not working

    - by Kevin Brown
    jQuery: $('#welcome-message').submit(function() { // inside event callbacks 'this' is the DOM element so we first // wrap it in a jQuery object and then invoke ajaxSubmit $(this).ajaxSubmit({}); $(this).fadeTo(400, 0, function () { // Links with the class "close" will close parent $(this).slideUp(400); }); return false; }); Controller: function welcome_message() { if(isset($_POST['welcome_message'])) { $this-_my_private_function(); } } private function _my_private_function() { $id = $this->session->userdata('id'); $profile['welcome_message'] = '0'; $this->db->update('be_user_profiles',$profile, array('user_id' => $id)); redirect('home', 'location'); } html: <?php print form_open('home/welcome_message',array('class'=>'horizontal','id'=>'welcome-message'))?> <p> Before you can complete the assessment, you need to complete your profile. Once that's done you'll be ready! After you have completed the assessment, you will be able to view the results from your profile. </p> <input type="checkbox" value="0" name="welcome_message" checked="false"> Don't show me this again </input> <p> <input class="button submit" type="submit" class="close-box" value="Close" /> </p> <?php print form_close()?> This should be working. My hypothesis is that the data isn't being passed to the function...but I really have no idea! It works when I visit the function in the url.

    Read the article

  • Auto complete from database using CodeIgniter (Active Record)

    - by Ralph David Abernathy
    I have a form on my website in which one is able to submit a cat. The form contains inputs such as "Name" and "Gender", but I am just trying to get the auto completion to work with the "Name" field. Here is what my jquery looks like : $(document).ready(function() { $( "#tags" ).autocomplete({ source: '/Anish/auto_cat' }); }); Here is what my model looks like: public function auto_cat($search_term) { $this->db->like('name', $search_term); $response = $this->db->get('anish_cats')->result_array(); // var_dump($response);die; return $response; } } Here is my controller: public function auto_cat(){ $search_term = $this->input->get('term'); $cats = $this->Anish_m->auto_cat($search_term); } And here is my view: <head> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> </head> <h1>Anish's Page</h1> <form action="/Anish/create" method="POST"> <div class="ui-widget"> <label for="tags">Name</label><input id="tags" type="text" name="name"> </div> <div> <label>Age</label><input type="text" name="age"> </div> <div> <label>Gender</label><input type="text" name="gender"> </div> <div> <label>Species</label><input type="text" name="species"> </div> <div> <label>Eye Color</label><input type="text" name="eye_color"> </div> <div> <label>Color</label><input type="text" name="color"> </div> <div> <label>Description</label><input type="text" name="description"> </div> <div> <label>marital status</label><input type="text" name="marital_status"> </div> <br> <button type="submit" class="btn btn-block btn-primary span1">Add cat</button> </form> <br/><br/><br/><br/> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Name</th> <th>Gender</th> <th>Age</th> <th>Species</th> <th>Eye Color</th> <th>Color</th> <th>Description</th> <th>Marital Status</th> <th>Edit</th> <th>Delete</th> </tr> </thead> <tbody> <?php foreach ($cats as $cat):?> <tr> <td> <?php echo ($cat['name']);?><br/> </td> <td> <?php echo ($cat['gender']);?><br/> </td> <td> <?php echo ($cat['age']);?><br/> </td> <td> <?php echo ($cat['species']);?><br/> </td> <td> <?php echo ($cat['eye_color']);?><br/> </td> <td> <?php echo ($cat['color']);?><br/> </td> <td> <?php echo ($cat['description']);?><br/> </td> <td> <?php echo ($cat['marital_status']);?><br/> </td> <td> <form action="/Anish/edit" method="post"> <input type="hidden" value="<?php echo ($cat['id']);?>" name="Anish_id_edit"> <button class="btn btn-block btn-info">Edit</button> </form> </td> <td> <form action="/Anish/delete" method="post"> <input type="hidden" value="<?php echo ($cat['id']);?>" name="Anish_id"> <button class="btn btn-block btn-danger">Delete</button> </form> </td> </tr> <?php endforeach;?> </tbody> </table> I am stuck. In my console, I am able to see this output when I type the letter 'a' if I uncomment the var_dump in my model: array(4) { [0]=> array(9) { ["id"]=> string(2) "13" ["name"]=> string(5) "Anish" ["gender"]=> string(4) "Male" ["age"]=> string(2) "20" ["species"]=> string(3) "Cat" ["eye_color"]=> string(5) "Brown" ["color"]=> string(5) "Black" ["description"]=> string(7) "Awesome" ["marital_status"]=> string(1) "0" } [1]=> array(9) { ["id"]=> string(2) "16" ["name"]=> string(5) "Anish" ["gender"]=> string(2) "fe" ["age"]=> string(2) "23" ["species"]=> string(2) "fe" ["eye_color"]=> string(2) "fe" ["color"]=> string(2) "fe" ["description"]=> string(2) "fe" ["marital_status"]=> string(1) "1" } [2]=> array(9) { ["id"]=> string(2) "17" ["name"]=> string(1) "a" ["gender"]=> string(1) "a" ["age"]=> string(1) "4" ["species"]=> string(1) "a" ["eye_color"]=> string(1) "a" ["color"]=> string(1) "a" ["description"]=> string(1) "a" ["marital_status"]=> string(1) "0" } [3]=> array(9) { ["id"]=> string(2) "18" ["name"]=> string(4) "Matt" ["gender"]=> string(6) "Female" ["age"]=> string(2) "80" ["species"]=> string(6) "ferret" ["eye_color"]=> string(4) "blue" ["color"]=> string(4) "pink" ["description"]=> string(5) "Chill" ["marital_status"]=> string(1) "0" } }

    Read the article

  • url encoded forward slashes breaking my codeigniter app

    - by Ian Cook
    i’m trying to create a url string that works like this: /app/process/example.com/index.html so in other words, /app/process/$URL i then retrieve the url with $this->uri->segment(3); the forward slashes in the URL will of course be a problem accessing uri segments, so i’ll go ahead and url encode the URL portion: /app/process/example.com%2Findex.html .. but now I just get a 404 saying ... Not Found The requested URL /app/process/example.com/index.html was not found on this server. it appears that my url encoding of forward slashes breaks CI’s URI parser. what can i do to get around this problem?

    Read the article

  • Codeigniter multi language url

    - by Thang Bui
    Please help me. I search 2 hours but do not see any solutions for my case. My customer request me the multi language but they want the link as: http://site.com/controller_name/lang_code Or http://site.com/controller_name/paramenter1/parameter2/lang_code The language code is always at the last segment. It is stored in the session. The url maybe also http://site.com/controller_name/ Or http://site.com/controller_name/paramenter1/parameter2/ In this case. The language stored in session will be loaded, but the url don't need to display it. I try i18n library, but it cannnot solve my problem. Can anyone help me

    Read the article

  • PHP & CodeIgniter Error: open_basedir restriction in effect

    - by iamdadude
    open_basedir restriction in effect. File(/var/www/vhosts/domain.com) is not within the allowed path(s): (/var/www/vhosts/domain.com/httpdocs:/tmp) How do I securely fix this? This is preventing me from listing and creating directories outside of the current directory. What I mean by securely is that I don't want to remove a piece of code from a configuration file and potentially make it easier for hackers to do whatever.

    Read the article

  • rewrite rule for codeigniter

    - by John
    this is my controller in CI class Welcome extends Controller { function Welcome() { parent::Controller(); } function index() { } function bil($model='') { } I want to do a rewrite so that http://example.com/index.php/welcome/bil/model becomes http://example.com/model in my htaccess I have RewriteBase / RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/welcome/$1 [L] #RewriteRule ^(.*)$ /index.php/welcome/bil/$1 [L] I thought it should be as easy as removing the /index.php/welcome/ part but when I uncomment the last line it get 500 internal server error

    Read the article

  • Codeigniter - form not rendering on live server?

    - by pingu
    hi guys, I've written a small website with CI, which is all working fine on dev. However, when I copy the files over for live, everything works except for my form which is not being rendered. I am using <?php echo form_open('home'); ?> and <?php echo form_close(); ?> The form fields within the form, which I'm generating as follows are being rendered fine, but there is simply no form around them?! <?php $data = array( 'name'=> 'name', 'id'=> 'name', 'class'=>'textfield', 'value' => set_value('name') ); echo form_input($data); ?> Any ideas - I've used CI on a few apps, and this is the first time I've come across this issue. I've got all the helpers etc called correctly, as this is working perfectly in the development environment.

    Read the article

  • Passing Results from SQL to Google Maps API in CodeIgniter

    - by Jason Shultz
    I'm hoping to use google maps on my site. My addresses are stored in a db. I’m pulling up a page where the information is all dynamic. For example: mysite.com/site/business/5 (where 5 is the id of the business). Let’s say I do a query like this: function addressForMap($id) { $this->db->select(‘b.id, b.busaddress, b.buscity, b.buszip’); $this->db->from(‘business as b’); $this->db->where(‘b.id, $id); } How can I output the info to the google maps api correctly so that it display’s the map appropriately? The API interface takes the results like this: $marker['address'] = 'Crescent Park, Palo Alto';

    Read the article

  • How to change Controllers/Models source directory in CodeIgniter

    - by Ady Mareshal
    I need to load controllers and models from a different folder than the default one. I am using a Linux system. I am building a simple CI application for some people, for use on a shared hosting I own. But I want to give them access only to /views folder and some /config files. And this is why I need to store the controllers and models in a different folder on the same level as /public_html folder or maybe somewhere in the linux system. I consider this would be a better solution than encoding files

    Read the article

  • Cannot exit in CodeIgniter constructor

    - by gzg
    I'm basically trying a session control. If the user is logged in, it's ok to move on. But if he's not logged in, then it will show a log-in screen and then die. However, when I use die or exit in the constructor, it does not show the log-in screen; it immediately dies. The code is as following: private $username = null; private $mongoid = null; private $neoid = null; public function __construct(){ parent::__construct(); // session to global $this->username = $this->session->userdata( 'username'); $this->mongoid = $this->session->userdata( 'mongoid'); $this->neoid = $this->session->userdata( 'neoid'); // check if user is logged in if( $this->username == "" || empty( $this->username)){ $this->load->view( 'access/login'); die; } } It shows the log-in page if die is not written there, but with die, it does not show. Why do I want to use die? Because if I don't use, it moves on the index function and I don't want it to execute index function if the user is not logged in. What is wrong here? What should I use to stop executing?

    Read the article

  • Codeigniter: Library function--I'm stuck

    - by Kevin Brown
    I have a library function that sets up my forms, and submits data. They're long, and they work, so I'll spare you reading my code. :) I simply need a way for my functions to determine how to handle the data. Until now, the function did one thing: Submit a report for the current user. NOW, the client has requested that an administrator also be able to complete a form--this means that the form would be filled out, and it would CREATE a user at the same time, whereas the current function EDITS and is accessed by an EXISTING user. Do I need a separate function to do essentially the same thing? How do I make one function perform two tasks? One to update a user, and if there is no user, create one. Current controller: function survey() { $id = $this->session->userdata('id'); $data['member'] = $this->home_model->getUser($id); //Convert the db Object to a row array $data['manager'] = $data['member']->row(); $manager_id = $data['manager']->manager_id; $data['manager'] = $this->home_model->getUser($manager_id); $data['manager'] = $data['manager']->row(); $data['header'] = "Home"; $this->survey_form_processing->survey_form($this->_container,$data, $method); } Current Library: function survey_form($container) { //Lots of validation stuff $this->CI->validation->set_rules($rules); if ( $this->CI->validation->run() === FALSE ) { // Output any errors $this->CI->validation->output_errors(); } else { // Submit form $this->_submit(); } $this->CI->load->view($container,$data); The submit function is huge too. Basically says, "Update table with data where user_id=current user" I hope this wasn't too confusing. I'll create two functions if need be, but I'd like to keep redundancy down! }

    Read the article

  • site search with codeigniter?

    - by sonill
    hi, i need to make a simple site search with a pagination in it, can anyone tell me how to do it with out affecting the url structure. currently i m using default ci url structrue and i have removed index.php from it. any sugestion guys?....

    Read the article

  • Access Codeigniter database functions from file

    - by Manny Calavera
    Hello. I am using a SWFupload script and I can't make a request from flash with mod_rewrite, I don't know why... I just need to point the Flash request to that file directly. This file runs an upload script that works ok but now I need to save some info to the database and I would like to know what should I write to have access from that file that is not called from the controller and does not extend the model in order to run a mysql query. Thanks.

    Read the article

  • Passing jquery JSON from Codeigniter controller to view

    - by dede
    I've been struggling to make it work, but cannot pass the inserted data from the controler to the view in CI using JSON. The input value from the form is successfully inserted into the database, but cannot make it appear in the view. This is my view file ajax_view.php: <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery-1.4.2.min.js"></script> $(document).ready(function(){ $("#submit").click(function(){ var inp = $('#inp').val(); $.post("ajax/ajax_input", { 'send' : inp }, function(data){ alert(data.input_text); }, "json"); }); }); </script> </head> <body> <form id="form1" method="post" action=""> <label for="inp">Text</label> <input type="text" name="inp" id="inp" /> <label for="submit"></label> <input type="submit" name="submit" id="submit" value="Submit" /> And this is the ajax_input method of the ajax.php controller: <?php // Initializing controller ..... // ............................. //ajax method function ajax_input(){ $var_1 = trim($this->input->post('send')); $array = array('input_text' => $var_1); echo json_encode($array); $this->db->insert('ajax',$array); } Trying to debug it with Firebug, it gives me that data.input_text is empty. What am I doing wrong? EDIT: I'm using XAMPP on Win, so is it posible that json configuration is the problem?

    Read the article

  • Codeigniter database update

    - by Carry All
    The table is like this and I want to update DecryptionDate by specify ArchiveID and RecipientID this is my code $this->load->database(); $date = date("Y-m-d H:i:s"); $data = array('DecryptionDate' => $date); $array = array('ArchiveID'=>$archiveID.'','RecipientID'=>$userID.''); $this->db->where($array); $this->db->update('log', $data); if ($this->db->affected_rows() > 0) { echo "SUCCESS"; } else { echo "FAIL"; } my problem is I can update the data only when $archiveID is 911 and $userID is test01 but the program fail to update when $archiveID is 911 and $userID is test02

    Read the article

  • PHP/codeigniter - use of exit()

    - by Patrick
    I have a few pages that require login, so all controllers that link to these pages start with $this->checkSession(); //...rest of the code CheckSession should verify the session is still live, otherwise display a message and stop the execution of the rest of the code in the controller: function checkSession() { if (!$this->session->userdata('is_logged_in')) { //the session has expired! $data['main'] = 'confirmation_message'; $data['title'] = "Session expired"; $this->load->vars($data); $this->load->view('template'); exit(); } } . I was expecting these instructions to happen in sequence, but I only get a blank page. How can I make sure exit() gets executed only after all views are loaded?

    Read the article

  • CodeIgniter: Weird echo of $config coming back when I load Email Library

    - by k00k
    Version info: CI version 1.7.2 - PHP 5.3.1 - Apache2 - Mac OSX 10.6.3 For some reason, when I load CI's email library, either in my controller, or in autoload.php, it automatically and immediately echoes the config info like so: $config['protocol'] = 'sendmail'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['charset'] = 'iso-8859-1'; $config['wordwrap'] = TRUE If I autoload the email library in autoload.php, it is echoed before anything else in my source/page. If I call it explicitly within my controller, it's echoed at that exact point. I'm stumped, never seen that before. Any ideas on how to surpress/eliminate?

    Read the article

  • Write permissions with Codeigniter + Simplepie

    - by Malachi
    I am trying to create a simple RSS parser using the two frameworks. However I am getting PHPerrors when trying to write to my cache directory: set_cache_location(APPPATH.'cache/rss'); I am running windows 7 with XAMPP using the latest version of Simplepie from github error: A PHP Error was encountered Severity: User Warning Message: C:\xampp\htdocs\geekurls/system/application/cache/rss is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable. Filename: libraries/simplepie.php Line Number: 1732

    Read the article

  • Codeigniter Write_file Question

    - by Brad
    I am writing to a txt file to back up certain posts. Here is my simple code $this->path = APPPATH . "post_backups/"; $string = $this->input->post('post'); $post_title = $this->input->post('post_title'); $this->file = $this->path . $post_title."txt"; write_file($this->file, $string); $this->index(); Every thing works fine except this $this->file = $this->path . $post_title."txt"; I am trying to name my file with the title of the post IE: title.txt. What I am getting it s this "titletxt". How should the $post_title . "txt" be written to provide txt as an extension? Thanks

    Read the article

  • Codeigniter Template library, add_js() method

    - by Karl
    using This Template Library when i try and use the add_js() function it errors out. I add the regions $_scripts to the template header file but when i load the page it says undefined variable _scripts. any thoughts? changed <?= $_scripts ?> to <?= (isset($_scripts)) ? $_scripts : “”; ?> and obviously i lose the error but the js file still isnt loading. I did an echo at each step though the add_js() method and the output is correct. I also did an output of $this-js and they both had the corret output. So it gets through the get_js method fine and sets the class variable fine but i dont get anything added to the actual page.

    Read the article

  • Displaying data from mutliple arrays with codeigniter

    - by Craig Ward
    I am trying to display results from a database where the results are contained in three tables. How do I echo out the results? $p- works, but $img- or $branch- doesn't. What am I doing wrong? Example code is below Sample controller: $p_id = $this-uri-segment(3); $this-load-model('One_model'); $data['prop'] = $this-One_model-get_details($p_id); $data['img'] = $this-One-get_images($p_id); $this-load-model('Two_model'); $data['branch'] = $this-Two_model-get_details($p_id); $this-load-view('a_test_view', $data); A Sample View <?php foreach ($property as $p):?> <p><?php echo $p->SUMMARY; ?></p> <p>We have <?php echo "$img->num_photos"; ?> photos</p> <p>Branch is <?php echo $branch->name; ?>. Telephone <?php echo $branch->tel; ?></p> <ul> <li><?php echo $p->FEATURE1; ?></li> <li><?php echo $p->FEATURE2; ?></li> <li><?php echo $p->FEATURE3; ?></li> <li><?php echo $p->FEATURE4; ?></li> <li><?php echo $p->FEATURE5; ?></li> <li><?php echo $p->FEATURE6; ?></li> <li><?php echo $p->FEATURE7; ?></li> <li><?php echo $p->FEATURE8; ?></li> <li><?php echo $p->FEATURE9; ?></li> <li><?php echo $p->FEATURE10; ?></li> </ul> <?php endforeach; ?>

    Read the article

  • Codeigniter: simple form function

    - by Kevin Brown
    I'm stuck writing a simple form...I feel dumb. Here's my controller: function welcome_message(){ //Update welcome message $id = $this->session->userdata('id'); $profile['welcome_message'] = $this->input->post('welcome_message'); $this->db->update('be_user_profiles',$profile, array('user_id' => $id)); } And the html: <?php print form_open('home/welcome_message')?> <input type="checkbox" value="0" checked="false">Don't show me this again</input> <p> <input class="button submit" type="submit" class="close-box" value="Close" /> </p> <?php print form_close()?> Edit I simply need it to submit to a private function and return to the home page (page submitted from).

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >