Welcome Guest, Not a member yet? Register   Sign In
Form
#1

[eluser]davy_yg[/eluser]
controllers/ccontactus.php

Code:
<?php

include 'page.php';

class Ccontactus extends Page {

    public function __construct(){

  parent::__construct();

  $this->data['assetscont'] = array(
   'contactcss' => base_url().'assets/css/contact.css'  
  );

    }

    public function index(){
    
  $this->load->view('templates/navigation', $this->data['navigation']);  
  $this->load->view('contactus',$this->data['assetscont']);
  $this->load->view('templates/footer', $this->data['footer']);
    }

public function contact(){

       $this->load->library('form_validation');
    $this->form_validation->set_rules('name', 'name', 'required');
    $this->form_validation->set_rules('email', 'email', 'required');
    $this->form_validation->set_rules('subject', 'subject', 'required');
    $this->form_validation->set_rules('message', 'message', 'required');

    if ($this->form_validation->run() == FALSE)
    {
    $this->load->view('contactus');
    }
    else
    {
    
    
    $this->load->helper(array('form', 'url'));
    $this->load->library('email');
    $this->email->from('[email protected]', 'Your Name');
    $this->email->to('[email protected]');
    $this->email->cc('[email protected]');
    $this->email->bcc('[email protected]');
    $this->email->subject('Email Test');
    $this->email->message('Testing the email class.');
    
    if (!$this->email->send())
    {
    $this->load->view('contactus');
    } else
    {
    $this->load->view('contactus_emailsent');
    }
    
    }
    }

}

?>


routes.php

Code:
$route['contactus'] = 'ccontactus';


views/contactus.php

Code:
<div id="title">Your Message: </div><br><br>

&lt;?php echo form_open('ccontactus/contact', array('id'=>'contactform'));

      echo form_label('Username', 'username');

      $dataName = array(
              'name'        => 'username',
              'id'          => 'username',
              'value'       => '',
              'maxlength'   => '100',
              'size'        => '50',
              'style'       => 'width:50%',
            );

   echo form_input($dataName);

?&gt;

RESULT:

Fatal error: Call to undefined function form_open() in C:\xampp\htdocs\IndonusaCI\application\views\contactus.php on line 72

line 72: &lt;?php echo form_open('ccontactus/contact', array('id'=>'contactform'));


I wonder why?


Messages In This Thread
Form - by El Forum - 10-19-2013, 05:10 AM
Form - by El Forum - 10-19-2013, 06:38 AM
Form - by El Forum - 10-19-2013, 07:36 AM
Form - by El Forum - 10-19-2013, 09:56 AM
Form - by El Forum - 10-19-2013, 03:23 PM
Form - by El Forum - 10-19-2013, 05:22 PM
Form - by El Forum - 10-19-2013, 08:45 PM
Form - by El Forum - 10-20-2013, 01:52 AM
Form - by El Forum - 10-20-2013, 08:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB