Welcome Guest, Not a member yet? Register   Sign In
Edit Pages
#18

Well, in that case I do not know how to use the boolean.  I try this printing out echo to proof if it is successful.


views/settings.php


PHP Code:
<div class="widget-box">
                        <
div class="widget-title"><h5>Settings</h5></div>
                        <
div class="widget-content">
                        
                        <?
php 
                        
                        
if($setting === TRUE){
                            
                            echo 
"Update has been successful."
                            
                        
}



                        
?>
                        
                        <?php echo $success_message?>
                        <?php echo validation_errors(); ?>
                        
                        <?php echo form_open('Cpages/updatesettings'); ?>                        
                        
                        <table border="0" style="width: 100%; height: 90px;">
                        
                        <?php foreach($setting as $setting_item): ?>
                        
                            <tr>
                                <td><b>Contact Information</b></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>Email</td>
                                <td><input type="text" name="email" value="<?php echo $setting_item['email']; ?>"></td>
                            </td>    
                            <tr>
                                <td>Site Name</td>
                                <td><input type="text" name="sitename" value="<?php echo $setting_item['site_name']; ?>"></td>
                            </td>
                            <tr>
                                <td></td>
                                <td><br></td>                                
                            </tr>    
                            <tr>
                                <td><b>Site Information</b></td>
                                <td></td>
                            </td>
                            <tr>
                                <td>Meta Title</td>
                                <td><input type="text" name="title" value="<?php echo $setting_item['meta_title']; ?>"></td>
                            </td>
                            <tr>
                                <td>Meta Keyword</td>
                                <td><input type="text" name="keyword" value="<?php echo $setting_item['meta_keyword']; ?>"></td>
                            </td>
                            <tr>
                                <td>Meta Description</td>
                                <td><input type="text" name="description" value="<?php echo $setting_item['meta_description']; ?>"></td>
                            </td>
                            <tr>
                                <td></td>
                                <td><br></td>                                
                            </tr>
                            <tr>
                                <td><b>Social Media Information</b></td>
                                <td></td>
                            </td>
                            <tr>
                                <td>Facebook</td>
                                <td><input type="text" name="facebook" value="<?php echo $setting_item['facebook']; ?>"></td>
                            </td>
                            <tr>
                                <td>Twitter</td>
                                <td><input type="text" name="twitter" value="<?php echo $setting_item['twitter']; ?>"></td>
                            </td>
                            <tr>
                                <td>RSS</td>
                                <td><input type="text" name="rss" value="<?php echo $setting_item['rss']; ?>"></td>
                            </tr>
                            <tr>
                                <td></td>
                                <td><br></td>                                
                            </tr>    
                            <tr>
                                <td></td>
                                <td><input type="submit" name="submit" class="edit" value="Submit"></td>
                            </tr>                    
                        
                        <?php endforeach ?>
                        
                        </table>            
                        </div> 



controllers/Cpages.php


PHP Code:
public function updatesettings() {
        
        
$this->load->helper('form');
        
$this->load->library('form_validation');
        
        
$this->form_validation->set_rules('email''Email''required');
        
$this->form_validation->set_rules('sitename''Sitename''required');
        
$this->form_validation->set_rules('title''Title''required');
        
$this->form_validation->set_rules('keyword''Keyword''required');
        
$this->form_validation->set_rules('description''Description''required');
        
$this->form_validation->set_rules('facebook''Facebook''required');
        
$this->form_validation->set_rules('twitter''Twitter''required');
        
$this->form_validation->set_rules('rss''RSS''required');
        
                
        if (
$this->form_validation->run() === FALSE)
        {    
// return to first 
        
            
$data['success_message'] = "";
            
            
$this->load->view('settings'$data);
        }    
        else
        {
            
$data['success_message'] = "Setting has been successfully updated!";    
            
            
$data['setting'] = $this->Mpages->add_settings();
            
$this->load->view('settings'$data);
            
        }
    
    } 
" If I looks more intelligence please increase my reputation."
Reply


Messages In This Thread
Edit Pages - by davy_yg - 08-27-2016, 05:22 AM
RE: Edit Pages - by InsiteFX - 08-27-2016, 10:30 AM
RE: Edit Pages - by davy_yg - 08-27-2016, 02:57 PM
RE: Edit Pages - by ciadmin - 08-27-2016, 04:29 PM
RE: Edit Pages - by PaulD - 08-27-2016, 05:27 PM
RE: Edit Pages - by davy_yg - 08-27-2016, 06:09 PM
RE: Edit Pages - by davy_yg - 08-27-2016, 10:40 PM
RE: Edit Pages - by InsiteFX - 08-28-2016, 04:00 AM
RE: Edit Pages - by davy_yg - 08-28-2016, 09:02 AM
RE: Edit Pages - by ciadmin - 08-28-2016, 09:36 AM
RE: Edit Pages - by albertleao - 08-28-2016, 10:29 AM
RE: Edit Pages - by Wouter60 - 08-28-2016, 10:38 AM
RE: Edit Pages - by davy_yg - 08-28-2016, 01:25 PM
RE: Edit Pages - by InsiteFX - 08-28-2016, 01:27 PM
RE: Edit Pages - by davy_yg - 08-28-2016, 04:02 PM
RE: Edit Pages - by Joel Catantan - 08-29-2016, 06:34 PM
RE: Edit Pages - by albertleao - 08-28-2016, 09:40 PM
RE: Edit Pages - by ciadmin - 08-28-2016, 09:53 PM
RE: Edit Pages - by davy_yg - 08-28-2016, 10:10 PM
RE: Edit Pages - by davy_yg - 08-28-2016, 10:22 PM
RE: Edit Pages - by ciadmin - 08-28-2016, 10:35 PM
RE: Edit Pages - by InsiteFX - 08-29-2016, 05:19 AM
RE: Edit Pages - by albertleao - 08-29-2016, 09:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB